I have been trying to get my CircleCI 2.0 setup working, but I’m bumping into a weird problem.
First let me explain my setup. I have an environment defined with docker compose. I have still chosen
machine as an executor because I need to be able to connect to the containers from the host (to run the integration tests). So my setup is following:
- Start containers
- Run tests with maven wrapper
Here is the configuration:
version: 2 jobs: build: machine: true working_directory: ~/Project steps: - checkout - run: name: Start container command: | set -x docker-compose up -d - run: name: Run tests command: | mkdir -p ~/.m2/ cp settings.xml ~/.m2/settings.xml cd Integrations/Tests ./mvnw verify -X
In the last run phase I’m bumping into following error:
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying artifact from /home/circleci/.m2/repository/fi/http-api-mock/1.1.0/http-api-mock-1.1.0.war to /home/circleci/Project/Integrations/Tests/target/http-api-mock.war at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:197) at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.copyArtifact(CopyMojo.java:94) at org.apache.maven.plugin.dependency.fromConfiguration.CopyMojo.execute(CopyMojo.java:72) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 26 more Caused by: java.io.IOException: Unable to open file /home/circleci/Project/Integrations/Tests/target/http-api-mock.war for writing. at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1134) at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1048) at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:192) ... 30 more
So it seems maven doesn’t have rights to write the file but doesn’t seem right. Test -folder doesn’t have target -folder beforehand (I checked) so it is generated on the go. And
circleci user should have all the rights and the maven wrapper is run with that user.
Am I missing something obvious?