1

Is there an easier way to copy all the war type artifacts in the child pom from parent pom and the imported boms.

I have the following plugin in the child pom,

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
      <execution>
        <id>copy</id>
        <phase>package</phase>
        <goals>
          <goal>copy-dependencies</goal>
        </goals>
        <configuration>
          <outputDirectory>${project.build.directory}/sources</outputDirectory>
          <stripClassifier>true</stripClassifier>
          <stripVersion>true</stripVersion>
          <includeTypes>war</includeTypes>
          <excludeTransitive>false</excludeTransitive>
        </configuration>
      </execution>
    </executions>
  </plugin>

This only copies the war artifacts to ${project.build.directory}/sources directory that are in the current pom, but does not transitively copy the wars from parent or the boms that are imported in parent.

I know that, in the child pom, if I explicitly mention the dependencies, that I am interested to copy, I get the expected results. But I have to manually identify all the war artifacts from parent and it's dependencies (boms) and add those in the child pom, which is very error prone.

Purpose : The child pom is used to generate a distribution build which packages all the war files from parent and it's dependent bom. The distribution package is then released as a jboss deploy-able artifact.

Is there an easier way to achieve what I need?

Note : I have control over only the child pom and the parent pom. I do not have control over the dependencies (boms) in the parent pom.

v3nM
  • 952
  • 1
  • 12
  • 19
  • Can you first explain why you need to do this? What is the purpose of that? – khmarbaise Dec 04 '16 at 08:52
  • @khmarbaise Updated the question with the purpose. As I also mentioned, manually adding the artifacts from the parent pom and boms is error prone. – v3nM Dec 04 '16 at 14:46
  • If you have many war's which should be deployed on a JBoss you should do that via ear file...and apart from that there is no other way than to define those as dependencies to get them...It sounds like that this should be a multi module build which will build them.. – khmarbaise Dec 04 '16 at 18:22
  • @khmarbaise But I do not have control over the bom and pom dependencies in my parent pom. I do not exactly know how the multi-module build would work in this case. I am no expert in maven, any help would be highly appreciated. – v3nM Dec 04 '16 at 23:33

0 Answers0