w3c / ldp-testsuite

(UNMAINTAINED) Tests for Linked Data Platform (LDP)
Other
22 stars 29 forks source link

attach-javadocs error when running `mvn package` #234

Open michielbdejong opened 5 years ago

michielbdejong commented 5 years ago

When running mvn package with latest master and openjdk12, I see:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23.886 s
[INFO] Finished at: 2019-03-27T12:21:37+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar (attach-javadocs) on project ldp-testsuite: Execution attach-javadocs of goal org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-javadoc-plugin:2.9.1:jar: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-javadoc-plugin:2.9.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/michiel/.m2/repository/org/apache/maven/plugins/maven-javadoc-plugin/2.9.1/maven-javadoc-plugin-2.9.1.jar
[ERROR] urls[1] = file:/Users/michiel/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[2] = file:/Users/michiel/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar

I tried mvn package -Dmaven.javadoc.skip=true but same result. A .jar file is still produced, so I guess it's no big problem, but is there any way to get rid of this error? Use an older Java version, maybe?

michielbdejong commented 5 years ago

@acoburn maybe you know?

acoburn commented 5 years ago

@michielbdejong in my fork, I had to update a lot of the maven plugin version in order to get the code to build properly with a JDK 9+ environment. I also had to add some missing javadoc fields (@param ..., @return ... and @throws ...) since the javadoc tool seems to be more strict in the current JDK versions. For this particular error, I'd recommend two steps:

  1. updating the maven-javadoc-plugin to at least 3.0.0
  2. adding the missing javadoc fields
michielbdejong commented 5 years ago

Thanks a lot! Will try that.

pmcb55 commented 5 years ago

So @michielbdejong which option are you going to try!? i.e. 1) Making Aaron's suggested code changes (updating plugins + adding JavaDoc), or 2) Just use Aaron's fork. (I assume the latter!)

And @acoburn, have you submitted a PR to merge your fork back into Master? Or are there reasons for maintaining your fork separately...?

acoburn commented 5 years ago

@pmcb55 I have not submitted a PR to merge my changes into this repository because I wanted compiled artifacts that I could use with the TrellisLDP software, especially as part of an automated CI/CD pipeline (e.g. see this repository, particularly the run_ldp_testsuite.sh script). I was also under the impression that this codebase is, effectively, frozen, but if that is not the case, I can certainly clean up my changes and submit them as a PR.

michielbdejong commented 5 years ago

We want to use ldp-testsuite as one major part of the solid testsuite project. cc @kjetilk

michielbdejong commented 5 years ago

Using the trellis-ldp fork, I still get:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  10.797 s
[INFO] Finished at: 2019-03-28T13:24:59+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.0.1:jar (attach-javadocs) on project ldp-testsuite: MavenReportException: Error while generating Javadoc: 
[ERROR] Exit code: 1 - javadoc: error - The code being documented uses modules but the packages defined in https://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.
[ERROR] 
[ERROR] Command line was: /Library/Java/JavaVirtualMachines/openjdk-12.jdk/Contents/Home/bin/javadoc @options @packages
[ERROR] 
[ERROR] Refer to the generated Javadoc files in '/Users/michiel/gh/w3c/ldp-testsuite/target/apidocs' dir.
michielbdejong commented 5 years ago

Apart from that small build-time error, java -jar target/ldp-testsuite-0.2.0-SNAPSHOT-shaded.jar --server http://localhost:8000 --basic does work now, awesome!

acoburn commented 5 years ago

I now also notice that in the CI build configuration that I'm using, I exclude the javadoc build stage:

mvn clean install -Dmaven.javadoc.skip

And with that setting, I am also able to run a successful build on JDK 11 and JDK 12.

ishaileshmishra commented 5 years ago

Update plugin section maven-javadoc-plugin as below:

       <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.1.1</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <use>false</use>
                            <use>false</use>
                            <source>1.8</source>
                                <links><link>http://docs.oracle.com/javase/7/docs/api/</link>                                    <link>http://docs.oracle.com/javase/7/docs/api/</link></links>
                            <doclint>none</doclint>
                        </configuration>
                    </execution>
                </executions>
            </plugin>