开发者

maven-install-plugin: installing submodule jar files

开发者 https://www.devze.com 2023-02-07 11:00 出处:网络
I have an aggregation project with a half-dozen submodules.The builds all work but when I try mvn install:install-file I only get the top-level pom.I\'ve also tried mvn install:install I get the error

I have an aggregation project with a half-dozen submodules. The builds all work but when I try mvn install:install-file I only get the top-level pom. I've also tried mvn install:install I get the error "Cannot override read-only parameter: packaging in goal: install:install".

I have the install plugin specified in all submodules.

Parent POM:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-install-plugin</artifactId>
  <version>2.3.1</version>
  <configuration>
    <file>pom.xml</file>
    <groupId>com.pillardata</groupId>
    <artifactId>${project.artifactId}</artifactId>
    <version>${project.version}</version>
    <packaging>pom</packaging>
  </configuration>
</plugin>

Child POM:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-install-plugin</artifactId>
  <version>2.3.1</version>     
  <configuration>

    <file>${project.build.directory}/${project.artifactId}-${pr开发者_StackOverflow社区oject.version}.jar/</file>
    <groupId>com.pillardata</groupId>
    <artifactId>${project.artifactId}</artifactId>
    <version>${project.version}</version>
    <packaging>jar</packaging>
  </configuration>
</plugin>

Other people seem to have this working but I've been hitting a dead-end after several hours of research and trying everything (reasonable) I can think of.

Ideas?

P.S., this is maven 2.2.1.


I'm not sure I understand fully your question, so here it is.

You have a project with some modules, like this:

   A
   |
   +-- B
   |
   +-- C

and you need to 'install' each module's artifact in the maven local repository. Then all you need to do is run: mvn install

you can run this from either (sub-)module and the whole sub-tree will be installed. If you want to install them individually (i.e. prevent the command from being called on each sub-module) then you can use the -N flag: mvn install -N

There shouldn't be any need to define anything whatsoever to install artifacts for you maven project.


You have to inherit the parent pom in the sub-projects and specify the children in the parent as "modules". See [POM][1]

0

精彩评论

暂无评论...
验证码 换一张
取 消