You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dependencies are not exposed to maven central causing build failure #201
This causes our test cases to fail due to missing classes of various stores. Can you please help us with it?
java.lang.NoClassDefFoundError: org/spdx/spdxRdfStore/RdfStore
at org.spdx.tools.SpdxToolsHelper.fileTypeToStore(SpdxToolsHelper.java:100)
at org.spdx.tools.SpdxToolsHelper.deserializeDocumentCompatV2(SpdxToolsHelper.java:211)
at org.eclipse.sw360.spdx.SpdxBOMImporter.openAsSpdx(SpdxBOMImporter.java:134)
If I add org.spdx:spdx-rdf-store:2.0.0 as dependency of my pom.xml, Java start complaining about java.lang.NoClassDefFoundError: org/spdx/v3jsonldstore/JsonLDStore
Note that the unit tests for the tools-java also depend on the spdx-rdf-store and are passing.
I noticed that the POM files in SW360 are referencing both the tools-java and the spdx-java-library - the latter shouldn't be needed since there is a transitive dependency to spdx-java-library. Other than that, I didn't see anything wrong in the PR from a cursory look.
@GMishx - perhaps running mvn test with the debug option -X will shed some light on where the issue is.
Hey @goneall , I had to add the spdx-java-library as a dependency to my pom.xml as tools-java only reports junit as its dependency and I start getting symbol missing errors:
[ERROR] /home/z003u7px/development/sw360/backend/common/src/main/java/org/eclipse/sw360/datahandler/db/ComponentDatabaseHandler.java:[73,21] package org.spdx.core does not exist
[ERROR] /home/z003u7px/development/sw360/backend/common/src/main/java/org/eclipse/sw360/spdx/SpdxBOMImporter.java:[36,21] package org.spdx.core does not exist
[ERROR] /home/z003u7px/development/sw360/backend/common/src/main/java/org/eclipse/sw360/spdx/SpdxBOMImporter.java:[37,21] package org.spdx.core does not exist
[ERROR] /home/z003u7px/development/sw360/backend/common/src/main/java/org/eclipse/sw360/spdx/SpdxBOMImporter.java:[38,46] package org.spdx.library.model.v2.enumerations does not exist
I am attaching the output of $ mvn clean package -Dbase.deploy.dir=. -DskipTests=true -X -U as requested for you to look at: logs.txt
Even mvn dependency:tree says org.spdx:tools-java:jar:2.0.0:compile has no transitive dependency.
I verified that this broke in the 2.0.0-RC1 build. The last working build was v1.1.8.
I compare the 2 POM files and experimented with the differences in the Shade file configuration, matching the same values as v1.1.8 and the problem still occurs. Quite a mystery.
I just checked out the tools-java version 1.1.8 and rebuilt it with no modifications. All the dependencies disappeared. So it looks like this is due to some change to Maven and not a change to tools-java.
We can fix this by forcing the earlier (working) version of the Shade plugin.
The suggestion is to publish 2 separate artifact IDs, but all our documentation points to generated a jar with dependencies + the shaded jar. I personally disagree with the logic expressed in the referenced issue since we're using Shade to generate a separate JAR file for a different intended use.
Activity
bact commentedon Apr 22, 2025
Thank you.
I can see there're changes in dependencies between 2.0.0-Alpha and 2.0.0-RC1.
bact commentedon Apr 22, 2025
pom.xmlin the repo looks fine with dependencies in<dependencies />section.goneall commentedon Apr 22, 2025
From a quick look, the dependency that is reported missing is present in the tools-java POM file:
Note that the unit tests for the tools-java also depend on the spdx-rdf-store and are passing.
I noticed that the POM files in SW360 are referencing both the tools-java and the spdx-java-library - the latter shouldn't be needed since there is a transitive dependency to spdx-java-library. Other than that, I didn't see anything wrong in the PR from a cursory look.
@GMishx - perhaps running
mvn testwith the debug option-Xwill shed some light on where the issue is.bact commentedon Apr 22, 2025
In the Maven Central pages, I found that the difference are those dependencies in the "COMPILE" scope.
goneall commentedon Apr 23, 2025
Thanks @bact for the pointer - I'll look into this.
GMishx commentedon Apr 23, 2025
Hey @goneall , I had to add the
spdx-java-libraryas a dependency to mypom.xmlastools-javaonly reports junit as its dependency and I start getting symbol missing errors:I am attaching the output of
$ mvn clean package -Dbase.deploy.dir=. -DskipTests=true -X -Uas requested for you to look at: logs.txtEven
mvn dependency:treesaysorg.spdx:tools-java:jar:2.0.0:compilehas no transitive dependency.bact commentedon Apr 23, 2025
@goneall I have near zero knowledge about releasing distribution on Maven Central, but which jar will be downloaded with this:
as our build will produce two jars (excluding javadoc.jar), one with dependencies and one without.
Does there a chance this is something to do with shading?
When browsing https://central.sonatype.com/artifact/org.spdx/tools-java/2.0.0/dependencies with "Dependency Type: Indirect" it shows none.
goneall commentedon Apr 23, 2025
I'm able to duplicate the problem with just a very simple POM file with the tools-java dependency. No indirect dependencies show up.
Removing the Shade plugin solved the problem.
Now the question is "why" and how do we fix it?
The Shade plugin is used to generate the "jar-with-dependencies". I would not expect it to interfere with the actual Jar file.
I'll do a bit more digging.
goneall commentedon Apr 23, 2025
I verified that this broke in the 2.0.0-RC1 build. The last working build was v1.1.8.
I compare the 2 POM files and experimented with the differences in the Shade file configuration, matching the same values as v1.1.8 and the problem still occurs. Quite a mystery.
goneall commentedon Apr 23, 2025
I just checked out the tools-java version 1.1.8 and rebuilt it with no modifications. All the dependencies disappeared. So it looks like this is due to some change to Maven and not a change to tools-java.
bact commentedon Apr 23, 2025
Maybe we take this opportunity to try the
nexus-staging-maven-plugin?(and also fix this spdx/Spdx-Java-Library#315 ?)
bact commentedon Apr 23, 2025
But "COMPILE" scope dependencies in libraries like
spdx-java-coreetc looks fine, hmm.goneall commentedon Apr 23, 2025
I think I found the source of the issue - this is an intentional update to the shade plugin - reference: https://issues.apache.org/jira/browse/HIVE-28455
We can fix this by forcing the earlier (working) version of the Shade plugin.
The suggestion is to publish 2 separate artifact IDs, but all our documentation points to generated a jar with dependencies + the shaded jar. I personally disagree with the logic expressed in the referenced issue since we're using Shade to generate a separate JAR file for a different intended use.
Fix Shade plugin version to 3.2.4
goneall commentedon Apr 23, 2025
@GMishx - Thanks for reporting the issue.
If you want a temporary workaround, you can manually add back all the dependencies in your POM file:
GMishx commentedon Apr 24, 2025
Thanks for digging @bact and @goneall .
I'll prefer to wait until the issue is resolved rather than fixing my pom.xml twice 😛
GMishx commentedon Apr 28, 2025
I see the PR is merged with the fix. Will you be releasing a new version (presumably 2.0.1)?
Fix Shade plugin version to 3.2.4
goneall commentedon Apr 28, 2025
I have another dependency that is being updated, once that's released I'll do a patch release for the tools-java - likely today.
goneall commentedon Apr 28, 2025
@GMishx - I just release version 2.0.1 which should fix this issue. Let me know if you have any other issues.
GMishx commentedon Apr 29, 2025
I just updated my branch with 2.0.1 and everything is working again. Thank you for the quick fix!
Sync with original repository (#1)