Skip to content

Conversation

@sgala
Copy link
Contributor

@sgala sgala commented Oct 12, 2021

Those are changes needed to build noe-core with jdk17

The changes work and build the tests generating classes for target java 1.6 (current) or java 1.8, except there is an error in building the javadocs. To get it working:

mvn clean package -Pcomplete -Dmaven.javadoc.skip=true
(...)
[WARNING] Tests run: 98, Failures: 0, Errors: 0, Skipped: 3
(...)
[INFO] --- maven-javadoc-plugin:3.3.1:jar (attach-javadocs) @ noe-core-testsuite ---
[INFO] Skipping javadoc generation
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Noe core: Parent 0.17.7-SNAPSHOT:
[INFO] 
[INFO] Noe core: Parent ................................... SUCCESS [  1.014 s]
[INFO] Noe core ........................................... SUCCESS [ 26.315 s]
[INFO] Noe core: Testsuite ................................ SUCCESS [  0.942 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.360 s
[INFO] Finished at: 2021-10-12T10:59:56+02:00
[INFO] ------------------------------------------------------------------------

This code builds with openjdk-11 and openjdk-17 and passes the tests, but the javadoc fails the same with both jdks. The error is:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:jar (attach-javadocs) on project noe-core: MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1 - /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/CmdBuilder.java:5: error: cannot find symbol
[ERROR] import noe.common.utils.Platform;
[ERROR]                        ^
[ERROR]   symbol:   class Platform
[ERROR]   location: package noe.common.utils
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/CmdBuilder.java:28: error: cannot find symbol
[ERROR]     protected static final Platform platform = new Platform();
[ERROR]                            ^
[ERROR]   symbol:   class Platform
[ERROR]   location: class CmdBuilder<THIS>
[ERROR]   where THIS is a type-variable:
[ERROR]     THIS extends CmdBuilder<THIS> declared in class CmdBuilder
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/PsCmdData.java:4: error: cannot find symbol
[ERROR] import noe.common.utils.Platform;
[ERROR]                        ^
[ERROR]   symbol:   class Platform
[ERROR]   location: package noe.common.utils
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/ListProcess.java:8: error: cannot find symbol
[ERROR] import noe.common.utils.Cmd;
[ERROR]                        ^
[ERROR]   symbol:   class Cmd
[ERROR]   location: package noe.common.utils
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/ListProcess.java:9: error: cannot find symbol
[ERROR] import noe.common.utils.Platform;
[ERROR]                        ^
[ERROR]   symbol:   class Platform
[ERROR]   location: package noe.common.utils
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/ListProcess.java:42: error: cannot find symbol
[ERROR]     private final Platform platform = new Platform();
[ERROR]                   ^
[ERROR]   symbol:   class Platform
[ERROR]   location: class ListProcess
[ERROR] /home/sgala/RedHat/Code/noe-core/core/src/main/groovy/noe/common/newcmd/PsCmdData.java:17: error: cannot find symbol
[ERROR]     private static final Platform platform = new Platform();
[ERROR]                          ^
[ERROR]   symbol:   class Platform
[ERROR]   location: class PsCmdData
[ERROR] 
[ERROR] Command line was: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-4.fc34.x86_64/bin/javadoc @options @packages
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/home/sgala/RedHat/Code/noe-core/core/target/apidocs' dir.

And can be solved by adding :../classes to the classpath option in core/target/apidocs/options and re-running

cd core/target/apidocs
sed -i -e "[email protected]'@.jar:../classes@" options
/usr/lib/jvm/java-17-openjdk-17.0.0.0.35-1.rolling.fc34.x86_64/bin/javadoc @options @packages
(...)
Building index for all classes...
Generating /home/sgala/RedHat/Code/noe-core/core/target/apidocs/allclasses-index.html...
Generating /home/sgala/RedHat/Code/noe-core/core/target/apidocs/allpackages-index.html...
Generating /home/sgala/RedHat/Code/noe-core/core/target/apidocs/index-all.html...
Generating /home/sgala/RedHat/Code/noe-core/core/target/apidocs/overview-summary.html...
Generating /home/sgala/RedHat/Code/noe-core/core/target/apidocs/help-doc.html...
55 warnings

But I don't know how to fix it with maven, It seems to miss adding the generated classes to the classpath.

Note: Trying to generate the classes for target java 11 or 15 produces further errors

@AdamKrajcik AdamKrajcik requested review from jstefl and mmadzin October 12, 2021 09:29
<artifactId>groovy-all</artifactId>
<version>${org.codehaus.groovy.all.version}</version>
<type>jar</type>
<type>pom</type>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking whether it wouldn't be better to change from groovy-all to groovy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do it due to verbosity and having to chase dependencies. For what I tested we depend on at least groovy-<VER>.jar and groovy-ant-<VER>.jar. Maybe more.

BTW, I ran mvn dependency:analyze-report and it looks like we have a number of undeclared dependencies (I uncovered commons-collections while testing and this is why I ran the report), and a number of unused but declared ones.

But I feel insecure proceeding further as I have not yet been able to run the integration tests. I did not arrive to mvn verify , just compile, test and package (skipping javadocs). verify needs more set up, and solving the problem with building javadocs is IMO of higher priority.

Our "analyze report" (at master HEAD):

Dependency Analysis

Used and declared dependencies

GroupId ArtifactId Version Scope Classifier Type Optional
net.java.dev.jna jna 5.6.0 compile   jar false
org.codehaus.groovy groovy-all 2.4.19 compile   jar false
net.sourceforge.htmlunit htmlunit 2.15 compile   jar false
com.google.guava guava 29.0-jre compile   jar false
org.slf4j slf4j-api 1.7.30 compile   jar false
com.squareup.okhttp3 okhttp 4.8.0 compile   jar false
com.squareup.okhttp3 okhttp-urlconnection 4.8.0 compile   jar false
org.eclipse.jgit org.eclipse.jgit 5.8.0.202006091008-r compile   jar false
junit junit 4.13 test   jar false
org.powermock powermock-module-junit4 2.0.7 test   jar false
org.powermock powermock-api-mockito2 2.0.7 test   jar false
org.wildfly.extras.creaper creaper-core 1.6.1 compile   jar false

Used but undeclared dependencies

GroupId ArtifactId Version Scope Classifier Type Optional
commons-io commons-io 2.4 compile   jar false
commons-collections commons-collections 3.2.1 compile   jar false
org.powermock powermock-core 2.0.7 test   jar false
xml-apis xml-apis 1.4.01 compile   jar false
org.apache.commons commons-lang3 3.3.2 compile   jar false

Unused but declared dependencies

GroupId ArtifactId Version Scope Classifier Type Optional
org.apache.ant ant 1.10.8 compile   jar false
ch.qos.logback logback-classic 1.2.3 compile   jar false
org.wildfly.extras.creaper creaper-commands 1.6.1 compile   jar false
org.wildfly.core wildfly-controller-client 12.0.3.Final provided   jar false
org.wildfly.core wildfly-cli 12.0.3.Final provided   jar false

@jstourac
Copy link
Contributor

@sgala JFYI - #123 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants