0

I have one zip artifact of one repo present on the nexus repo. In compile phase, I need to download it in another repo using pom.xml and later move it to another folder using Docker.

To unpack the zip, I've written the following plugin in the pom.xml

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <artifactItems>
                        <artifactItem>
                            <groupId>projectGroupId</groupId>
                            <artifactId>ProjectAtrefact</artifactId>
                            <version>${project.version}-SNAPSHOT</version>
                            <type>zip</type>
                        </artifactItem>
                    </artifactItems>
                    <outputDirectory>${project.build.directory}/deps/dev</outputDirectory>
                    <overWrite>true</overWrite>
                    <stripVersion>true</stripVersion>
                    <excludeTransitive>true</excludeTransitive>
                    <includes>**</includes>
                </configuration>
            </plugin>

In the bamboo log, the zip file is downloaded and unpacked and the maven stage is successful.

[INFO] Downloaded from snapshots: http://repo.xyz.com:8081/nexus/content/groups/libs-snapshot/com/<parent>/<project>/1.0.0-SNAPSHOT/<project>-1.0.0-20220930.103511-22.zip (1.3 MB at 30 MB/s)
build   30-Sep-2022 10:41:36    [INFO] Unpacking /mnt/bamboo-ebs/bamboo-agent/artifacts/com/<parent>/<project>/1.0.0-SNAPSHOT/<project>-1.0.0-SNAPSHOT.zip to /mnt/bamboo-ebs/bamboo-agent/build-dir/SHARED-AD1-JOB1/target/deps/dev with includes "*" and excludes ""

With the above, the unpacked zip folder should be present in the target/deps/dev folder but when I did RUN ls -lR target it is saying the folder does not exist.

#9 [4/6] RUN ls -lR target
error   30-Sep-2022 10:42:05    #9 sha256:185ecaf76c80e6942603dec50ea957ddae25e329ceeed2c8b485455b6d3c92e2
error   30-Sep-2022 10:42:05    #9 0.508 ls: cannot access target: No such file or directory
error   30-Sep-2022 10:42:05    #9 ERROR: executor failed running [/bin/sh -c ls -lR target]: exit code: 2

What I am doing wrong here? Any advice?

5
  • You lack detail. Docker only sees what you have chosen to copy in from your context. The context is what is available when docker starts. Unpacking probably require the target directory to be present. Commented Oct 2, 2022 at 8:10
  • <outputDirectory>${project.build.directory}/deps/dev</outputDirectory> this should create the directory target/deps/dev and also confirmed from the bamboo logs - /mnt/bamboo-ebs/bamboo-agent/build-dir/SHARED-AD1-JOB1/target/deps/dev the folder is created in the root folder by bamboo agent. After this maven task is completed, the next task is the docker run which should get the target folder. Commented Oct 2, 2022 at 11:01
  • Does the download step work for yourself outside of docker? Commented Oct 2, 2022 at 11:12
  • yes, I have verified locally and in bamboo logs too. Commented Oct 3, 2022 at 19:29
  • In bamboo logs? This might be a file permission problem Commented Oct 3, 2022 at 19:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.