0

I have local instance of Drone running and am trying to build a couple of very simple Maven projects. They are perfectly normal and follow all conventions.

I am using the latest Drone docker image (as of today) and have an agent and server set up in a Rancher environment. A local Gogs instance is the Git repo.

When Drone runs the build, Maven is unable to compile the test classes because it can't find the compiled source classes. It's happening on two different projects which compile with no problems using the following methods:

  • on the command line with Maven
  • in IntelliJ
  • running the Docker maven image while mounting the project directory and executing the build that way.

It's only the Drone build which fails. I am stumped. Any ideas anyone?

Here is the .drone.yml

pipeline:
  build:
    image: maven:3.5.0-alpine
    commands:
      - mvn -B clean package

Here is some sample output:

[INFO] Compiling 8 source files to /drone/src/192.168.1.116:10080/timw/springboot-docker-clean/compare/458b3364de013c475723da83162368bacf6ba239...fd89653daf594250d11f8cba004939b7a95199f6/target/classes
109s
836
[INFO] 
110s
837
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ springboot-docker-clean ---
110s
838
[INFO] Using 'UTF-8' encoding to copy filtered resources.
110s
839
[INFO] skip non existing resourceDirectory /drone/src/192.168.1.116:10080/timw/springboot-docker-clean/compare/458b3364de013c475723da83162368bacf6ba239...fd89653daf594250d11f8cba004939b7a95199f6/src/test/resources
110s
840
[INFO] 
110s
841
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ springboot-docker-clean ---
110s
842
[INFO] Changes detected - recompiling the module!
110s
843
[INFO] Compiling 7 source files to /drone/src/192.168.1.116:10080/timw/springboot-docker-clean/compare/458b3364de013c475723da83162368bacf6ba239...fd89653daf594250d11f8cba004939b7a95199f6/target/test-classes
110s
844
[INFO] -------------------------------------------------------------
112s
845
[ERROR] COMPILATION ERROR : 
112s
846
[INFO] -------------------------------------------------------------
112s
847
[ERROR] /drone/src/192.168.1.116:10080/timw/springboot-docker-clean/compare/458b3364de013c475723da83162368bacf6ba239...fd89653daf594250d11f8cba004939b7a95199f6/src/test/java/org/timw/docker/DockerJavaClientTest.java:[31,13] cannot find symbol
112s
848
  symbol:   class DockerJavaClient
112s
849
  location: class org.timw.docker.DockerJavaClientTest
Tim Webster
  • 684
  • 8
  • 18

1 Answers1

1

The issue is that drone uses your repository url in the workspace path. In your example the repository url includes the port name (colon) which seems to be causing issues when maven tries to read the file.

/drone/src/192.168.1.116:10080

You can manually override the workspace path in your yaml using the following syntax:

workspace:
  path: src/timw/springboot-docker-clean

pipeline:
  build:
    image: maven:3.5.0-alpine
    commands:
      - mvn -B clean package
Brad Rydzewski
  • 2,523
  • 14
  • 18