Skip to content

Added ability to provide arbitrary dependencies to properties mojo#1561

Merged
slawekjaranowski merged 2 commits into
apache:masterfrom
treilhes:master
May 7, 2026
Merged

Added ability to provide arbitrary dependencies to properties mojo#1561
slawekjaranowski merged 2 commits into
apache:masterfrom
treilhes:master

Conversation

@treilhes

Copy link
Copy Markdown
Contributor

This PR allows providing arbitrary dependencies to project properties through the plugin’s declared dependencies.
My main use case for this feature is the ability to patch a Java module with a dependency that is outside of the project’s dependency tree (mainly to solve duplicate package name).

See sample below


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>resolve-jar-path</id>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.somegroup</groupId>
                        <artifactId>someartifact</artifactId>
                        <version>someversion</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>--patch-module</arg>
                        <arg>module.to.patch=${com.somegroup:someartifact:jar}</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>

@desruisseaux

Copy link
Copy Markdown

It seems related to #1560, maybe a replacement?

@treilhes

Copy link
Copy Markdown
Contributor Author

@desruisseaux
It is the same content you can safely forget about #1560

@slawekjaranowski slawekjaranowski left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that adding artifacts to plugin dependencies is not good idea ...
it will be added to plugin classpath - that is not needed.

I would prefer add a new parameters for additional artifact, next artifact can be resolved and file path can be added to properties

@slawekjaranowski slawekjaranowski added the waiting-for-feedback Waiting for 90 days until issues or pull request will be closed label Jan 27, 2026
@github-actions

Copy link
Copy Markdown

This pull request is stale because it has been waiting for feedback for 60 days. Remove the stale label or comment on this PR, or it will be automatically closed in 30 days.

@treilhes

treilhes commented Apr 7, 2026

Copy link
Copy Markdown
Contributor Author

Hello @slawekjaranowski

Updated as requested, now you may use the plugin as follow:


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>resolve-jar-path</id>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <extraArtifacts>
                        <extraArtifact>
                            <groupId>com.somegroup</groupId>
                            <artifactId>someartifact</artifactId>
                            <version>someversion</version>
                        </extraArtifact>
                    </extraArtifacts>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <compilerArgs>
                        <arg>--patch-module</arg>
                        <arg>module.to.patch=${com.somegroup:someartifact:jar}</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>

@github-actions github-actions Bot removed waiting-for-feedback Waiting for 90 days until issues or pull request will be closed Stale labels Apr 7, 2026
@slawekjaranowski slawekjaranowski added the enhancement New feature or request label May 5, 2026
@slawekjaranowski
slawekjaranowski merged commit 963fd3c into apache:master May 7, 2026
17 checks passed
@github-actions github-actions Bot added this to the 3.10.1 milestone May 7, 2026
@slawekjaranowski

Copy link
Copy Markdown
Member

@treilhes thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants