apache / maven-mvnd

Apache Maven Daemon
https://maven.apache.org/
Apache License 2.0
3.19k stars 223 forks source link

Using an openjdk 8 my modules fail with compilation issues due to not finding javax.annotation #747

Open landrus opened 2 years ago

landrus commented 2 years ago

I configured mvnd to use openjdk 1.8.0_352, which builds our software correctly using normal mvn. When I build with mvnd I get compilation issue where the javax.annotation package cannot be found

To me it looks like certain plugins are not executing the configured jre and I do have more than one installed in my system.

❯ mvnd -v
mvnd 0.8.2 darwin-amd64 native client (2bba2d6a4d3a5012ddf9f1f42a22784cad4011e3)Terminal: org.jline.terminal.impl.PosixSysTerminal with pty org.jline.terminal.impl.jansi.osx.OsXNativePty
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: /usr/local/Cellar/mvnd/0.8.2/libexec/mvn
Java version: 1.8.0_352, vendor: Homebrew, runtime: /usr/local/Cellar/openjdk@8/1.8.0+352/libexec/openjdk.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "13.0.1", arch: "x86_64", family: "mac"

The complete output from mvnd is the following:

❯ mvnd package -DskipTests -f modules/common/support-info
[INFO] Processing build on daemon 74415462[INFO] Scanning for projects...
[INFO] BuildTimeEventSpy is registered.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] support-information-parent                                         [pom]
[INFO] system-information-supplier                                        [jar]
[INFO] system-information-exposer-fragment                                [jar]
[INFO] 
[INFO] Using the SmartBuilder implementation with a thread count of 15
[INFO] Task segments : [package]
[INFO] Build maximum degree of concurrency is 15
[INFO] Total number of projects is 3
[INFO] 
[INFO] ----------< com.assentis.support:support-information-parent >-----------
[INFO] Building support-information-parent 7.0.0-SNAPSHOT                 [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ support-information-parent ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ support-information-parent ---
[INFO] ShortRevision tag detected. The value is '8'.
[INFO] Executing: /bin/sh -c cd '/opt/projects/workspaces/dev/docfamily/modules/common/support-info' && 'git' 'rev-parse' '--verify' '--short=8' 'HEAD'
[INFO] Working directory: /opt/projects/workspaces/dev/docfamily/modules/common/support-info
[WARN] [stderr] javassist.NotFoundException: start(..) is not found in java.lang.ProcessBuilder
[INFO] Storing buildNumber: 4434b414 at timestamp: 1669892404242
[INFO] Storing buildScmBranch: master
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (prepare-agent) @ support-information-parent ---
[INFO] argLine set to -javaagent:/opt/projects/repository/org/jacoco/org.jacoco.agent/0.8.4/org.jacoco.agent-0.8.4-runtime.jar=destfile=/opt/projects/workspaces/dev/docfamily/target/jacoco-unit.exec,append=true
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (flatten) @ support-information-parent ---
[INFO] Generating flattened POM of project com.assentis.support:support-information-parent:pom:7.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (default) @ support-information-parent ---
[INFO] 
[INFO] ----------< com.assentis.support:system-information-supplier >----------
[INFO] Building system-information-supplier 7.0.0-SNAPSHOT                [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ system-information-supplier ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ system-information-supplier ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (prepare-agent) @ system-information-supplier ---
[INFO] argLine set to -javaagent:/opt/projects/repository/org/jacoco/org.jacoco.agent/0.8.4/org.jacoco.agent-0.8.4-runtime.jar=destfile=/opt/projects/workspaces/dev/docfamily/target/jacoco-unit.exec,append=true
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ system-information-supplier ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/resources
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (flatten) @ system-information-supplier ---
[INFO] Generating flattened POM of project com.assentis.support:system-information-supplier:jar:7.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ system-information-supplier ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[8,23] error: package javax.annotation does not exist
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/SystemInformationCollector.java:[7,23] error: package javax.annotation does not exist
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[38,5] error: cannot find symbol
  symbol:   class Resource
  location: class DataSourceCollector
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[40,5] error: cannot find symbol
  symbol:   class Resource
  location: class DataSourceCollector
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/SystemInformationCollector.java:[28,5] error: cannot find symbol
  symbol:   class PostConstruct
  location: class SystemInformationCollector
[INFO] 5 errors 
[INFO] -------------------------------------------------------------
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Skipping system-information-exposer-fragment
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for support-information-parent 7.0.0-SNAPSHOT:
[INFO] 
[INFO] support-information-parent ......................... SUCCESS [  2.692 s]
[INFO] system-information-supplier ........................ FAILURE [  2.034 s]
[INFO] system-information-exposer-fragment ................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.020 s (Wall Clock)
[INFO] Finished at: 2022-12-01T12:00:07+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project system-information-supplier: Compilation failure: Compilation failure: 
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[8,23] error: package javax.annotation does not exist
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/SystemInformationCollector.java:[7,23] error: package javax.annotation does not exist
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[38,5] error: cannot find symbol
[ERROR]   symbol:   class Resource
[ERROR]   location: class DataSourceCollector
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/collector/DataSourceCollector.java:[40,5] error: cannot find symbol
[ERROR]   symbol:   class Resource
[ERROR]   location: class DataSourceCollector
[ERROR] /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/java/com/assentis/support/systeminfo/supplier/SystemInformationCollector.java:[28,5] error: cannot find symbol
[ERROR]   symbol:   class PostConstruct
[ERROR]   location: class SystemInformationCollector
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -r

running it with my normal mvn command, it looks like the following output. Once thing to note, as well, is that in the mvnd output there is an issue with the buildnumber plugin, which also looks like sth isn't using the jre I provided:

❯ mvn8 package -DskipTests -f modules/common/support-info
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] support-information-parent                                         [pom]
[INFO] system-information-supplier                                        [jar]
[INFO] system-information-exposer-fragment                                [jar]
[INFO] 
[INFO] ----------< com.assentis.support:support-information-parent >-----------
[INFO] Building support-information-parent 7.0.0-SNAPSHOT                 [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ support-information-parent ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ support-information-parent ---
[INFO] ShortRevision tag detected. The value is '8'.
[INFO] Executing: /bin/sh -c cd '/opt/projects/workspaces/dev/docfamily/modules/common/support-info' && 'git' 'rev-parse' '--verify' '--short=8' 'HEAD'
[INFO] Working directory: /opt/projects/workspaces/dev/docfamily/modules/common/support-info
[INFO] Storing buildNumber: 4434b414 at timestamp: 1669892706961
[INFO] Storing buildScmBranch: master
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (prepare-agent) @ support-information-parent ---
[INFO] argLine set to -javaagent:/opt/projects/repository/org/jacoco/org.jacoco.agent/0.8.4/org.jacoco.agent-0.8.4-runtime.jar=destfile=/opt/projects/workspaces/dev/docfamily/target/jacoco-unit.exec,append=true
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (flatten) @ support-information-parent ---
[INFO] Generating flattened POM of project com.assentis.support:support-information-parent:pom:7.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (default) @ support-information-parent ---
[INFO] 
[INFO] ----------< com.assentis.support:system-information-supplier >----------
[INFO] Building system-information-supplier 7.0.0-SNAPSHOT                [2/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ system-information-supplier ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ system-information-supplier ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (prepare-agent) @ system-information-supplier ---
[INFO] argLine set to -javaagent:/opt/projects/repository/org/jacoco/org.jacoco.agent/0.8.4/org.jacoco.agent-0.8.4-runtime.jar=destfile=/opt/projects/workspaces/dev/docfamily/target/jacoco-unit.exec,append=true
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ system-information-supplier ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/main/resources
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (flatten) @ system-information-supplier ---
[INFO] Generating flattened POM of project com.assentis.support:system-information-supplier:jar:7.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ system-information-supplier ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/target/classes
[INFO] 
[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (default) @ system-information-supplier ---
[INFO] Building jar: /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/target/system-information-supplier-7.0.0-SNAPSHOT-sources.jar
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ system-information-supplier ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ system-information-supplier ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ system-information-supplier ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ system-information-supplier ---
[INFO] Building jar: /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-supplier/target/system-information-supplier-7.0.0-SNAPSHOT.jar
[INFO] 
[INFO] ------< com.assentis.support:system-information-exposer-fragment >------
[INFO] Building system-information-exposer-fragment 7.0.0-SNAPSHOT        [3/3]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-maven-version) @ system-information-exposer-fragment ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.4:create (default) @ system-information-exposer-fragment ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.4:prepare-agent (prepare-agent) @ system-information-exposer-fragment ---
[INFO] argLine set to -javaagent:/opt/projects/repository/org/jacoco/org.jacoco.agent/0.8.4/org.jacoco.agent-0.8.4-runtime.jar=destfile=/opt/projects/workspaces/dev/docfamily/target/jacoco-unit.exec,append=true
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ system-information-exposer-fragment ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 14 resources
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (flatten) @ system-information-exposer-fragment ---
[INFO] Generating flattened POM of project com.assentis.support:system-information-exposer-fragment:jar:7.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ system-information-exposer-fragment ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-source-plugin:3.2.1:jar-no-fork (default) @ system-information-exposer-fragment ---
[INFO] Building jar: /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-exposer/target/system-information-exposer-fragment-7.0.0-SNAPSHOT-sources.jar
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ system-information-exposer-fragment ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-exposer/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ system-information-exposer-fragment ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ system-information-exposer-fragment ---
[INFO] Tests are skipped.
[INFO] 
[INFO] --- maven-jar-plugin:3.2.2:jar (default-jar) @ system-information-exposer-fragment ---
[INFO] 
[INFO] --- maven-assembly-plugin:3.1.0:single (make-assembly) @ system-information-exposer-fragment ---
[INFO] Reading assembly descriptor: src/main/assembly/assembly.xml
[INFO] Building zip: /opt/projects/workspaces/dev/docfamily/modules/common/support-info/system-information-exposer/target/system-information-exposer-fragment-7.0.0-SNAPSHOT-bin.zip
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for support-information-parent 7.0.0-SNAPSHOT:
[INFO] 
[INFO] support-information-parent ......................... SUCCESS [  1.950 s]
[INFO] system-information-supplier ........................ SUCCESS [  2.600 s]
[INFO] system-information-exposer-fragment ................ SUCCESS [  1.136 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.932 s
[INFO] Finished at: 2022-12-01T12:05:11+01:00
[INFO] ------------------------------------------------------------------------
gnodet commented 2 years ago

@landrus can you provide steps to reproduce the problem ?