[ 
https://issues.apache.org/jira/browse/SLING-8682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16925470#comment-16925470
 ] 

Krystian Nowak edited comment on SLING-8682 at 9/9/19 9:05 AM:
---------------------------------------------------------------

[~cziegeler]: Isn't it the case that when sourcesDir is empty, no javadoc at 
all should be generated anyway? I was checking what happens in IT 
apis-jar-wrapped-flattened-classes in both Java 8 and Java 11 case.
 Even though in Java 8 it seems fine from outside:
{noformat}
docker volume create --name maven-repo
{noformat}
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-8 mvn clean 
install
{noformat}
pretends to work OK:
{noformat}
[INFO] Building: apis-jar-wrapped-flattened-classes/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           apis-jar-wrapped-flattened-classes/pom.xml ....... SUCCESS 
(92.2 s)
{noformat}
(...)
{noformat}
[INFO] BUILD SUCCESS
{noformat}
*BUT* when changing the directory:
{noformat}
cd target/it/apis-jar-wrapped-flattened-classes
{noformat}
and running:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-8 mvn clean 
install
{noformat}
we get:
{noformat}
[INFO] --- slingfeature-maven-plugin:1.1.1-SNAPSHOT:apis-jar (analyze) @ 
slingfeature-maven-plugin-test ---
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-sources.jar
[INFO] Executing javadoc tool: [/usr/local/openjdk-8/jre/../bin/javadoc, 
@/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test/base/base-javadoc]
[INFO] 
javadoc: error - No packages or classes specified.
{noformat}
(...)
{noformat}
1 error
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
{noformat}
(...)
{noformat}
[INFO] BUILD SUCCESS
{noformat}
In Java 11 instead:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-11 mvn clean 
install
{noformat}
results in expliticly failed IT:
{noformat}
[INFO] Building: apis-jar-wrapped-flattened-classes/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           apis-jar-wrapped-flattened-classes/pom.xml ....... FAILED 
(88.2 s)
[INFO]   The build exited with code 1. See 
/usr/src/mymaven/target/it/apis-jar-wrapped-flattened-classes/build.log for 
details.
{noformat}
resulting in:
{noformat}
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 7, Failed: 1, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  apis-jar-wrapped-flattened-classes/pom.xml
{noformat}
and
{noformat}
[INFO] BUILD FAILURE
{noformat}
Also diving into the specific directory:
{noformat}
cd target/it/apis-jar-wrapped-flattened-classes
{noformat}
and running:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-11 mvn clean 
install
{noformat}
we get an explicit javadoc error (similar to the one in Java 8 case, but this 
one fails the outer build, hence it was visible from outside):
{noformat}
[INFO] --- slingfeature-maven-plugin:1.1.1-SNAPSHOT:apis-jar (analyze) @ 
slingfeature-maven-plugin-test ---
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-sources.jar
[INFO] Executing javadoc tool: [/usr/local/openjdk-11/bin/javadoc, 
@/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test/base/base-javadoc]
[INFO] 
javadoc: error - No modules, packages or classes specified.
1 error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{noformat}
So it seems in case when _sourcesDir_ list in 
[https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java#L258-L260]
 is empty, both in Java 8 and Java 11 the _javadoc_ exec invocation fails, but 
the failure is not propagated up in Java 8, only in Java 11 case, hence only 
then it was visible from outside in SLING-8597 and the resulting 
[https://github.com/apache/sling-slingfeature-maven-plugin/commit/23e848409876cfa35b0ec8669612d73351f4e2e3]
 - possibly SLING-8681 could be extended into not calling _javadoc_ exec at all 
if _sourcesDir_ list is empty. It would result in not having javadocs jar 
produced in this case, but the jar produced in Java 8's case (when the error 
doesn't stop the build) is almost empty anyway:
{noformat}
$ unzip -l 
target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
Archive:  
target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
      201  09-09-2019 08:41   META-INF/MANIFEST.MF
        0  09-09-2019 08:41   META-INF/
        0  09-09-2019 08:41   META-INF/maven/
        0  09-09-2019 08:41   META-INF/maven/org.apache.sling/
        0  09-09-2019 08:41   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/
     2110  09-09-2019 08:24   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/pom.xml
      121  09-09-2019 08:41   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/pom.properties
---------                     -------
     2432                     7 files
{noformat}


was (Author: krystian):
[~cziegeler]: Isn't it the case that when sourcesDir is empty, no javadoc at 
all should be generated anyway? I was checking what happens in IT 
apis-jar-wrapped-flattened-classes in both Java 8 and Java 11 case.
Even though in Java 8 it seems fine from outside:

{noformat}
docker volume create --name maven-repo
{noformat}

{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-8 mvn clean 
install
{noformat}

pretends to work OK:

{noformat}
[INFO] Building: apis-jar-wrapped-flattened-classes/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           apis-jar-wrapped-flattened-classes/pom.xml ....... SUCCESS 
(92.2 s)
{noformat}
(...)
{noformat}
[INFO] BUILD SUCCESS
{noformat}

*BUT* when changing the directory:
{noformat}
cat target/it/apis-jar-wrapped-flattened-classes
{noformat}
and running:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-8 mvn clean 
install
{noformat}

we get:
{noformat}
[INFO] --- slingfeature-maven-plugin:1.1.1-SNAPSHOT:apis-jar (analyze) @ 
slingfeature-maven-plugin-test ---
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-sources.jar
[INFO] Executing javadoc tool: [/usr/local/openjdk-8/jre/../bin/javadoc, 
@/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test/base/base-javadoc]
[INFO] 
javadoc: error - No packages or classes specified.
{noformat}
(...)
{noformat}
1 error
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
{noformat}
(...)
{noformat}
[INFO] BUILD SUCCESS
{noformat}

In Java 11 instead:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-11 mvn clean 
install
{noformat}
results in expliticly failed IT:
{noformat}
[INFO] Building: apis-jar-wrapped-flattened-classes/pom.xml
[INFO] run post-build script verify.bsh
[INFO]           apis-jar-wrapped-flattened-classes/pom.xml ....... FAILED 
(88.2 s)
[INFO]   The build exited with code 1. See 
/usr/src/mymaven/target/it/apis-jar-wrapped-flattened-classes/build.log for 
details.
{noformat}
resulting in:
{noformat}
[INFO] -------------------------------------------------
[INFO] Build Summary:
[INFO]   Passed: 7, Failed: 1, Errors: 0, Skipped: 0
[INFO] -------------------------------------------------
[ERROR] The following builds failed:
[ERROR] *  apis-jar-wrapped-flattened-classes/pom.xml
{noformat}
and
{noformat}
[INFO] BUILD FAILURE
{noformat}

Also diving into the specific directory:
{noformat}
cat target/it/apis-jar-wrapped-flattened-classes
{noformat}
and running:
{noformat}
docker run -it --rm --name my-maven-project -v maven-repo:/root/.m2 -v 
"$(pwd)":/usr/src/mymaven -w /usr/src/mymaven maven:3.6.1-jdk-11 mvn clean 
install
{noformat}
we get an explicit javadoc error (similar to the one in Java 8 case, but this 
one fails the outer build, hence it was visible from outside):
{noformat}
[INFO] --- slingfeature-maven-plugin:1.1.1-SNAPSHOT:apis-jar (analyze) @ 
slingfeature-maven-plugin-test ---
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-apis.jar
[INFO] Building jar: 
/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-sources.jar
[INFO] Executing javadoc tool: [/usr/local/openjdk-11/bin/javadoc, 
@/usr/src/mymaven/target/apis-jars/slingfeature-maven-plugin-test/base/base-javadoc]
[INFO] 
javadoc: error - No modules, packages or classes specified.
1 error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
{noformat}

So it seems in case when _sourcesDir_ list in 
https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/main/java/org/apache/sling/feature/maven/mojos/ApisJarMojo.java#L258-L260
 is empty, both in Java 8 and Java 11 the _javadoc_ exec invocation fails, but 
the failure is not propagated up in Java 8, only in Java 11 case, hence only 
then it was visible from outside in SLING-8597 and the resulting 
[https://github.com/apache/sling-slingfeature-maven-plugin/commit/23e848409876cfa35b0ec8669612d73351f4e2e3]
 - possibly SLING-8681 could be extended into not calling _javadoc_ exec at all 
if _sourcesDir_ list is empty. It would result in not having javadocs jar 
produced in this case, but the jar produced in Java 8's case (when the error 
doesn't stop the build) is almost empty anyway:
{noformat}
$ unzip -l 
target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
Archive:  
target/apis-jars/slingfeature-maven-plugin-test-1.0.0-SNAPSHOT-base-javadoc.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
      201  09-09-2019 08:41   META-INF/MANIFEST.MF
        0  09-09-2019 08:41   META-INF/
        0  09-09-2019 08:41   META-INF/maven/
        0  09-09-2019 08:41   META-INF/maven/org.apache.sling/
        0  09-09-2019 08:41   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/
     2110  09-09-2019 08:24   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/pom.xml
      121  09-09-2019 08:41   
META-INF/maven/org.apache.sling/slingfeature-maven-plugin-test/pom.properties
---------                     -------
     2432                     7 files
{noformat}

> IT apis-jar-wrapped-flattened-classes fails
> -------------------------------------------
>
>                 Key: SLING-8682
>                 URL: https://issues.apache.org/jira/browse/SLING-8682
>             Project: Sling
>          Issue Type: Bug
>          Components: Maven Plugins and Archetypes
>            Reporter: Carsten Ziegeler
>            Priority: Major
>             Fix For: slingfeature-maven-plugin 1.1.2
>
>
> With the correction of subpackage handling in SLING-8681 the 
> apis-jar-wrapped-flattened-classes fails now.
> This might be a bug in our api handling code as the javadoc command does not 
> get a source



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to