An error while using the License Maven Plugin in a multi module project

Alexey

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?

P.K

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Maven jetty plugin - automatic reload using a multi-module project

From Dev

How to use Maven assembly plugin with multi module maven project

From Dev

Jboss as maven plugin to deploy Multi Module Maven Project

From Dev

How to use Maven assembly plugin with multi module maven project

From Dev

Error resolving dependency for maven multi module project

From Dev

Using Enunciate in multi-module Maven project

From Dev

Creating multi module project using Intellij & Maven

From Dev

Is there a Maven plugin listing all JUnit tests in a multi module project

From Dev

Multi module Maven project with wildfly-swarm-plugin

From Dev

How to configure Maven shade plugin in a multi-module project?

From Dev

Maven multi-module project does not fail on compilation error

From Dev

Using Configuration files in multi-module maven project

From Dev

maven-release-plugin in multi-module project having a seperate git repository for each module

From Dev

Convert maven project to submodule of multi module project?

From Dev

sonar-maven-plugin: extending sonar.sources in multi-module project

From Dev

sonar-maven-plugin: extending sonar.sources in multi-module project

From Dev

Maven Error: No plugin found for prefix ‘archetype’ in the current project using Nexus

From Dev

Sonar Maven plugin finds more bugs than Sonar Jenkins or Sonar CLI Scanner on multi-module Maven project

From Dev

Jacoco Maven multi module project coverage

From Dev

Putting a multi-module Maven project into Jenkins

From Dev

Maven Multi Module Project Structuring Issues

From Dev

Spring MVC in a multi maven module project

From Dev

How to create Maven Multi Module Project in Intellij?

From Dev

Nar dependency in multi-module maven project

From Dev

How to create Maven Multi Module Project in Intellij?

From Dev

Spring MVC in a multi maven module project

From Dev

Multi-module project structure Maven

From Dev

Refactoring of maven multi module project in eclipse

From Dev

Maven test lifecycle in a multi-module project

Related Related

  1. 1

    Maven jetty plugin - automatic reload using a multi-module project

  2. 2

    How to use Maven assembly plugin with multi module maven project

  3. 3

    Jboss as maven plugin to deploy Multi Module Maven Project

  4. 4

    How to use Maven assembly plugin with multi module maven project

  5. 5

    Error resolving dependency for maven multi module project

  6. 6

    Using Enunciate in multi-module Maven project

  7. 7

    Creating multi module project using Intellij & Maven

  8. 8

    Is there a Maven plugin listing all JUnit tests in a multi module project

  9. 9

    Multi module Maven project with wildfly-swarm-plugin

  10. 10

    How to configure Maven shade plugin in a multi-module project?

  11. 11

    Maven multi-module project does not fail on compilation error

  12. 12

    Using Configuration files in multi-module maven project

  13. 13

    maven-release-plugin in multi-module project having a seperate git repository for each module

  14. 14

    Convert maven project to submodule of multi module project?

  15. 15

    sonar-maven-plugin: extending sonar.sources in multi-module project

  16. 16

    sonar-maven-plugin: extending sonar.sources in multi-module project

  17. 17

    Maven Error: No plugin found for prefix ‘archetype’ in the current project using Nexus

  18. 18

    Sonar Maven plugin finds more bugs than Sonar Jenkins or Sonar CLI Scanner on multi-module Maven project

  19. 19

    Jacoco Maven multi module project coverage

  20. 20

    Putting a multi-module Maven project into Jenkins

  21. 21

    Maven Multi Module Project Structuring Issues

  22. 22

    Spring MVC in a multi maven module project

  23. 23

    How to create Maven Multi Module Project in Intellij?

  24. 24

    Nar dependency in multi-module maven project

  25. 25

    How to create Maven Multi Module Project in Intellij?

  26. 26

    Spring MVC in a multi maven module project

  27. 27

    Multi-module project structure Maven

  28. 28

    Refactoring of maven multi module project in eclipse

  29. 29

    Maven test lifecycle in a multi-module project

HotTag

Archive