dev-aspectj / aspectj-maven-plugin

AspectJ Maven Plugin
MIT License
48 stars 12 forks source link

The package javax.xml.stream is accessible from more than one module: <unnamed>, java.xml #104

Closed finalcreator closed 2 years ago

finalcreator commented 2 years ago

Failed when running mvn clean install under JDK 11

[ERROR] The package javax.xml.stream is accessible from more than one module: , java.xml [ERROR] XMLStreamException cannot be resolved to a type

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>${java.version}</source>
        <target>${java.version}</target>
                            <annotationProcessorPaths>
                                <path>
                                    <groupId>org.projectlombok</groupId>
                                    <artifactId>lombok</artifactId>
                                    <version>${lombok.version}</version>
                                </path>
                            </annotationProcessorPaths>
        <compilerArgs>
                                    <arg>--add-exports</arg>
                                    <arg>java.xml/com.sun.org.apache.xerces.internal.jaxp.datatype=ALL-UNNAMED</arg>
        </compilerArgs>
        <fork>true</fork>
    </configuration>
</plugin>

 <plugin>
                        <groupId>dev.aspectj</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <version>1.13.1</version>
                        <configuration>
                            <complianceLevel>${java.version}</complianceLevel>
                            <source>${java.version}</source>
                            <target>${java.version}</target>
                            <showWeaveInfo>true</showWeaveInfo>
                            <verbose>true</verbose>
                            <Xlint>ignore</Xlint>
                           <forceAjcCompile>true</forceAjcCompile>
                           <weaveDirectories>
                                <weaveDirectory>${project.build.directory}/classes</weaveDirectory>
                            </weaveDirectories>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
kriegaex commented 2 years ago

Please post a link to a full sample project on GitHub. It should be minimal, but complete, so I can reproduce the problem. This is called an MCVE. Thank you.

finalcreator commented 2 years ago

for simplicity, do we have example for "maven configure" for lombok&aspectj, and jetty&aspectj? (java 11 or later)

kriegaex commented 2 years ago

I asked you for an MCVE. So the answer cannot be that you ask me for one instead. If you like to get help and think there is a bug in the plugin, you need to make it easy for me to reproduce your problem, not for me to create a build-to-order MCVE for you. Feel free to hire me if you need that kind of service, though.

finalcreator commented 2 years ago

The actual situation is that the project dependencies are more complex and there is no way to simplify them, so I think if there is a standard reference project, maybe I can solve it myself. That's why I asked if there were any relevant examples.

finalcreator commented 2 years ago

The error is: The package org.w3c.dom is accessible from more than one module: , java.xml

I tried to add -add-exports but didn't work, is this configure correct?

--add-exports java.xml/org.w3c.dom=ALL-UNNAMED
kriegaex commented 2 years ago

The actual situation is that the project dependencies are more complex and there is no way to simplify them

That statement is unworthy of a developer. You can always simplify. Just strip off as much as possible, until only as much is left as is necessary to reproduce the problem. If I cannot reproduce your problem, I cannot help you. I do not feel so inclined to try and guess what kind of undisclosed situation you might have. I am closing this question as invalid. If you change your mind and provide an MCVE, we can re-open it.