Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "incompatible types: List<DependencyResource> cannot be converted to java.util.List<Dependency>" error #154

Merged
merged 1 commit into from
Aug 24, 2018

Conversation

jspricke
Copy link
Contributor

No description provided.

@jspricke
Copy link
Contributor Author

I integrated maven-jaxb2-plugin into Debian recently and had to add these two patches for it. Hope they are useful.

@highsource
Copy link
Owner

Arrays.<Dependency> is OK, can be merged.

@highsource
Copy link
Owner

As for using org.apache.xml, classes like org.apache.xml.resolver.CatalogManager are not on the classpath.

@jspricke
Copy link
Contributor Author

The internal version gave: "package com.sun.org.apache.xml.internal.resolver does not exist". Should we add org.apache.xml to the classpath, or what would you suggest? We can also leave this as a Debian only patch, if you would be ok with that.

@highsource
Copy link
Owner

The internal version gave: "package com.sun.org.apache.xml.internal.resolver does not exist".

This is weird. mvn dependency:tree on maven-jaxb2-plugin-core gives:

org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-core:jar:0.14.1-SNAPSHOT
+- javax.xml.bind:jaxb-api:jar:2.3.0:provided
+- org.slf4j:slf4j-api:jar:1.7.25:compile
+- org.apache.commons:commons-lang3:jar:3.2.1:compile
+- com.sun.org.apache.xml.internal:resolver:jar:20050927:compile
+- org.glassfish.jaxb:txw2:jar:2.3.0:compile
+- org.apache.maven:maven-plugin-api:jar:2.0.9:compile
+- org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
+- org.codehaus.plexus:plexus-utils:jar:1.5.15:compile
+- org.apache.maven:maven-project:jar:2.0.9:compile
|  +- org.apache.maven:maven-settings:jar:2.0.9:compile
|  +- org.apache.maven:maven-profile:jar:2.0.9:compile
|  +- org.apache.maven:maven-model:jar:2.0.9:compile
|  +- org.apache.maven:maven-artifact-manager:jar:2.0.9:compile
|  |  +- org.apache.maven:maven-repository-metadata:jar:2.0.9:compile
|  |  \- org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-2:compile
|  +- org.apache.maven:maven-plugin-registry:jar:2.0.9:compile
|  +- org.apache.maven:maven-artifact:jar:2.0.9:compile
|  \- org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:compile
|     \- classworlds:classworlds:jar:1.1-alpha-2:compile
+- org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.5:compile
+- org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:2.1:test
|  \- org.codehaus.plexus:plexus-archiver:jar:2.2:test
|     \- org.codehaus.plexus:plexus-io:jar:2.0.4:test
\- junit:junit:jar:4.8.1:test

The artifact com.sun.org.apache.xml.internal:resolver:jar:20050927 contains the com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver class.

Should we add org.apache.xml to the classpath, or what would you suggest? We can also leave this as a Debian only patch, if you would be ok with that.

I would like to understand, what's happening first of all.

@jspricke
Copy link
Contributor Author

com.sun.org.apache.xml.internal:resolver:jar:20050927:compile is not packaged in Debian (afaik), which is a requirement.

@highsource
Copy link
Owner

com.sun.org.apache.xml.internal:resolver is effectively a dependency of jaxb-xjc. I don't think we can just throw out this dependency and hope for good...

Another question: why is there a need in a special packaging for Debian? I don't know this story.

@jspricke
Copy link
Contributor Author

Well, I don't trow it out but replace it with the apache version, which should be the same (apart from the package name).

Debian requires to be self contained, i.e. all sources need to be in Debian as well.

@highsource
Copy link
Owner

com.sun.tools.xjc.CatalogUtil uses:

import com.sun.org.apache.xml.internal.resolver.CatalogManager;
import com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver;

I'll think about how to fix this.

@jspricke
Copy link
Contributor Author

I've pushed a patch to add the apache version to the classpath to make this working.

@jspricke
Copy link
Contributor Author

com.sun.tools.xjc.CatalogUtil is using the apache version as well in Debian, if I'm not wrong:
https://salsa.debian.org/java-team/jaxb/blob/master/debian/patches/04-xml-resolver-compatibility.patch

@jspricke
Copy link
Contributor Author

So I would propose to keep that patch in Debian and update this PR to only contain the Arrays fix, would you agree?

@highsource
Copy link
Owner

I think we should keep that patch in Debian. Accepting it into the master will most definitely break things here.

As for the Arrays fix, I don't quite understand, what the problem is. Arrays.asList is generic so the type parameter for the resulting list should be happily derived. I don't see any warning there - am I missing something?

@jspricke
Copy link
Contributor Author

I updated the PR to only contain the Arrays patch. The error I get is:
maven-jaxb2-plugin/plugin-core/src/main/java/org/jvnet/jaxb2/maven2/AbstractXJC2Mojo.java:[1303,70] incompatible types: java.util.List<org.jvnet.jaxb2.maven2.DependencyResource> cannot be converted to java.util.List<org.apache.maven.model.Dependency>

@highsource highsource changed the title Use org.apache.xml Fix "incompatible types: List<DependencyResource> cannot be converted to java.util.List<Dependency>" error Aug 24, 2018
@highsource
Copy link
Owner

I'm not getting this error, but OK, it's a minor change.

@highsource highsource merged commit 059a518 into highsource:master Aug 24, 2018
laurentschoelens pushed a commit to laurentschoelens/jaxb-tools that referenced this pull request May 12, 2023
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