Skip to content

Conversation

@cortlepp
Copy link
Member

it is a duplicate dependency of jakarta.servlet:jakarta.servlet-api, having duplicate classes should be avoided.

…`, harden build

this is a duplicate dependency of `jakarta.servlet:jakarta.servlet-api`, having duplicate classes should be avoided.
@cortlepp
Copy link
Member Author

cortlepp commented Feb 21, 2025

To further improve build integrity I also tried enabling a duplicate classes check by including the following snippet in the main pom, this however made the build fail in some ant stage with an obscure error which I didn't understand. Leaving this here for posterity if I/someone else wants to investigate this further.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <configuration>
        <failBuild>true</failBuild>
        <ignoreDirect>false</ignoreDirect>
    </configuration>
    <executions>
        <execution>
            <id>duplicate-dependency-check</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>analyze-dep-mgt</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This is the error I get:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:3.1.0:run (test-samples) on project distribution: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /home/cortlepp/code/axis-axis2-java-core/modules/distribution/target/axis2-2.0.0-SNAPSHOT/samples/databinding/build.xml:87: The following error occurred while executing this line:
[ERROR] /home/cortlepp/code/axis-axis2-java-core/modules/distribution/target/axis2-2.0.0-SNAPSHOT/samples/databinding/build.xml:43: /home/cortlepp/code/axis-axis2-java-core/modules/distribution/target/axis2-2.0.0-SNAPSHOT/samples/databinding/lib does not exist.
[ERROR] around Ant part ...<ant dir="/home/cortlepp/code/axis-axis2-java-core/modules/distribution/target/axis2-2.0.0-SNAPSHOT/samples/databinding" />... @ 6:128 in /home/cortlepp/code/axis-axis2-java-core/modules/distribution/target/antrun/build-main.xml
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :distribution

@robertlazarski
Copy link
Contributor

robertlazarski commented Feb 21, 2025

@cortlepp the patch looks fine and I am about to apply - thanks for finding that issue.

However, about the ant error ... I tried it out in the main pom.xml and couldn't reproduce the error. See the line numbers below - is that correct?

1117 <plugin> 1118 <artifactId>maven-dependency-plugin</artifactId> 1119 <version>3.8.1</version> 1120 <configuration> 1121 <failBuild>true</failBuild> 1122 <ignoreDirect>false</ignoreDirect> 1123 </configuration> 1124 <executions> 1125 <execution> 1126 <id>duplicate-dependency-check</id> 1127 <phase>prepare-package</phase> 1128 <goals> 1129 <goal>analyze-dep-mgt</goal> 1130 </goals> 1131 </execution> 1132 </executions> 1133 </plugin>

@robertlazarski
Copy link
Contributor

Sorry about the formatting ... I may commit it to make it clearer since I don't see any errors.

@cortlepp
Copy link
Member Author

Line 1117 is just the plugin management, that doesn't yet apply the plugin, right? I added the plugin in line 1660.

@robertlazarski
Copy link
Contributor

@cortlepp I like the idea though unfortunately the samples are meant to be run from the bin distro which has the expected lib dir - and I could not figure out how to tell the plugin to skip modules/samples.

I am going to merge the PR - thanks again for making these excellent contributions.

@robertlazarski robertlazarski merged commit 787544f into apache:master Feb 21, 2025
4 checks passed
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