Maven project structure
I have a trivial multi module Maven project:
parent-project
child-project1
(war
)child-project2
(jar
)parent-project
's pom.xml
references both child projects in its <modules>
section. Both child projects reference the parent in their <parent>
sections.
child-project1
depends on child-project2
(it references it in the <dependencies>
section).
The problem
I am trying to use the License Maven Plugin on the parent-project
to generates a file containing a list of all dependencies and their licenses:
mvn license:aggregate-add-third-party
I get an error:
Failed to execute goal on project child-project1: Could not resolve dependencies
for project ... child-project1 ... : Could not find artifact ... child-project2 ...
When I comment out the dependency of child-project1
on child-project2
the plugin works with no problem. So I can use the plugin, but I have to comment out the dependency each time I do it.
What is the problem? Is there a way to fix it?
The problem you are facing is that the maven-license-plugin
by default looks in your local repository for the child artifacts. I suppose, your plugin configuration in the parent pom.xml
looks like the following:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>1.6</version>
<configuration>
<!-- your own config goes here -->
</configuration>
</plugin>
</plugins>
You have to install your multi-module project to your local Maven repository using
mvn install
After that, you run
mvn license:aggregate-add-third-party
again and the build will succeed.
If you configured an <execution>
in your plugin, this will fail, since the maven-license-plugin
by default binds to the generate-resources
phase [1] and this is always executed prior to install
[2].
Cheers, PK
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments