griddynamics / mpl

[IT-36925] Jenkins Shared Modular Pipeline Library
https://blog.griddynamics.com/developing-a-modular-pipeline-library-to-improve-devops-collaboration/
Apache License 2.0
157 stars 97 forks source link

Secondary run of the mvn without tests causes failure #38

Closed sparshev closed 5 years ago

sparshev commented 5 years ago

Looks like generateTestStubs mojo makes impossible to just deploy the already built artifacts. For example:

$ mvn clean install
...
[INFO] BUILD SUCCESS
$ mvn -DskipTests package
...
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ mpl ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 16 source files to /Users/tkmakyv/Work/git/mpl/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[7,52] package com.lesfurets.jenkins.unit.global.lib does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[7,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[8,52] package com.lesfurets.jenkins.unit.global.lib does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[8,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[9,35] package org.assertj.core.api does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[9,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestBase.java:[11,37] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestHelper.java:[11,37] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestHelper.java:[15,62] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[16,33] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[17,11] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[18,11] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[19,11] package org.junit does not exist
[INFO] 13 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.969 s
[INFO] Finished at: 2019-08-17T11:36:30-07:00
[INFO] Final Memory: 39M/385M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mpl: Compilation failure: Compilation failure:
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[7,52] package com.lesfurets.jenkins.unit.global.lib does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[7,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[8,52] package com.lesfurets.jenkins.unit.global.lib does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[8,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[9,35] package org.assertj.core.api does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[9,1] static import only from classes and interfaces
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestBase.java:[11,37] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestHelper.java:[11,37] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/com/griddynamics/devops/mpl/testing/MPLTestHelper.java:[15,62] package com.lesfurets.jenkins.unit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[16,33] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[17,11] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[18,11] package org.junit does not exist
[ERROR] /Users/tkmakyv/Work/git/mpl/target/generated-sources/groovy-stubs/test/BuildTest.java:[19,11] package org.junit does not exist
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
zsh: exit 1     mvn -B -DskipTests package

Second command fails, because stubs requires additional tests packages, that will not be used if skipTests is defined.

We actually don't need these test stubs - so it's better to remove them.