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

Class collision between old jaxb2-basics-runtime and new one #465

Open
laurentschoelens opened this issue Dec 14, 2023 · 3 comments · May be fixed by #537
Open

Class collision between old jaxb2-basics-runtime and new one #465

laurentschoelens opened this issue Dec 14, 2023 · 3 comments · May be fixed by #537
Assignees
Labels
bug xjc-plugins Issue concerns basics plugins
Milestone

Comments

@laurentschoelens
Copy link
Collaborator

We have same classes in same packages in both jaxb2-basics-runtime (the one with previous groupId and the one with the current one).

Since groupId differs, having the new one does not override the older one and it can leads to ClassCastException if all the classes are not loaded from the same jar.

We should provide a way to override the older one with maybe like an empty jar with older groupId to make sure all classes are defined only once

@laurentschoelens laurentschoelens added bug xjc-plugins Issue concerns basics plugins labels Dec 14, 2023
@laurentschoelens laurentschoelens added this to the 2.0.10 milestone Dec 14, 2023
@laurentschoelens
Copy link
Collaborator Author

New project to handle this : https://github.com/laurentschoelens/jaxb2-basics-empty

@laurentschoelens laurentschoelens self-assigned this Feb 12, 2024
laurentschoelens added a commit to laurentschoelens/jaxb-tools that referenced this issue Apr 18, 2024
@laurentschoelens
Copy link
Collaborator Author

Include empty like project (same as above) in main branch so we can then include it in v2.x

@laurentschoelens
Copy link
Collaborator Author

Adding the following in org.jvnet.jaxb:jaxb2-basics-runtime :

    <dependency>
      <groupId>org.jvnet.jaxb2_commons</groupId>
      <artifactId>jaxb2-basics-runtime</artifactId>
      <version>[4.0.0,9999.0)</version>
    </dependency>

and having a project including 2 projects, one with old runtime and one with new runtime as dependencies, result in the following mvn dependencies:tree

BeforeAfter
maven
[INFO] --- dependency:3.6.0:tree (default-cli) @ jaxb2-basics-test-po-mixed-runtime ---
[INFO] org.jvnet.jaxb:jaxb2-basics-test-po-mixed-runtime:jar:2.0.10-SNAPSHOT
[INFO] +- org.jvnet.jaxb:jaxb2-basics-test-po:jar:2.0.10-SNAPSHOT:compile
[INFO] |  +- org.jvnet.jaxb:jaxb2-basics-runtime:jar:2.0.10-SNAPSHOT:compile
[INFO] |  +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.9:compile
[INFO] |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  +- org.glassfish.jaxb:txw2:jar:2.3.9:compile
[INFO] |  |  \- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] |  \- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- org.jvnet.jaxb:jaxb2-basics-test-po-old-runtime:jar:2.0.10-SNAPSHOT:compile
[INFO] |  \- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.13.1:compile
[INFO] \- junit:junit:jar:4.13.2:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] --- dependency:3.6.0:tree (default-cli) @ jaxb2-basics-test-po-mixed-runtime ---
[INFO] org.jvnet.jaxb:jaxb2-basics-test-po-mixed-runtime:jar:2.0.10-SNAPSHOT
[INFO] +- org.jvnet.jaxb:jaxb2-basics-test-po:jar:2.0.10-SNAPSHOT:compile
[INFO] |  +- org.jvnet.jaxb:jaxb2-basics-runtime:jar:2.0.10-SNAPSHOT:compile
[INFO] |  |  \- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:4.0.7-SNAPSHOT:compile
[INFO] |  +- org.glassfish.jaxb:jaxb-runtime:jar:2.3.9:compile
[INFO] |  |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:compile
[INFO] |  |  +- org.glassfish.jaxb:txw2:jar:2.3.9:compile
[INFO] |  |  \- com.sun.istack:istack-commons-runtime:jar:3.0.12:compile
[INFO] |  \- com.sun.activation:jakarta.activation:jar:1.2.2:compile
[INFO] +- org.jvnet.jaxb:jaxb2-basics-test-po-old-runtime:jar:2.0.10-SNAPSHOT:compile
[INFO] \- junit:junit:jar:4.13.2:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
gradle
compileClasspath - Compile classpath for source set 'main'.
+--- org.jvnet.jaxb:jaxb2-basics-test-po:2.0.10-SNAPSHOT
|    +--- org.jvnet.jaxb:jaxb2-basics-runtime:2.0.10-SNAPSHOT
|    +--- org.glassfish.jaxb:jaxb-runtime:2.3.9
|    |    +--- jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
|    |    +--- org.glassfish.jaxb:txw2:2.3.9
|    |    \--- com.sun.istack:istack-commons-runtime:3.0.12
|    \--- com.sun.activation:jakarta.activation:1.2.2
\--- org.jvnet.jaxb:jaxb2-basics-test-po-old-runtime:2.0.10-SNAPSHOT
     +--- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1
     +--- org.glassfish.jaxb:jaxb-runtime:2.3.9 (*)
     +--- org.jvnet.jaxb:jaxb2-basics-runtime:2.0.10-SNAPSHOT
     \--- com.sun.activation:jakarta.activation:1.2.2
compileClasspath - Compile classpath for source set 'main'.
+--- org.jvnet.jaxb:jaxb2-basics-test-po:2.0.10-SNAPSHOT
|    +--- org.jvnet.jaxb:jaxb2-basics-runtime:2.0.10-SNAPSHOT
|    |    \--- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:[4.0.0,9999.0) -> 4.0.7-SNAPSHOT
|    +--- org.glassfish.jaxb:jaxb-runtime:2.3.9
|    |    +--- jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
|    |    +--- org.glassfish.jaxb:txw2:2.3.9
|    |    \--- com.sun.istack:istack-commons-runtime:3.0.12
|    \--- com.sun.activation:jakarta.activation:1.2.2
\--- org.jvnet.jaxb:jaxb2-basics-test-po-old-runtime:2.0.10-SNAPSHOT
     +--- org.jvnet.jaxb2_commons:jaxb2-basics-runtime:0.13.1 -> 4.0.7-SNAPSHOT
     +--- org.glassfish.jaxb:jaxb-runtime:2.3.9 (*)
     +--- org.jvnet.jaxb:jaxb2-basics-runtime:2.0.10-SNAPSHOT (*)
     \--- com.sun.activation:jakarta.activation:1.2.2

laurentschoelens added a commit to laurentschoelens/jaxb-tools that referenced this issue Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug xjc-plugins Issue concerns basics plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants