attach-artifact goal from builder-helper-maven-plugin cancels default packaging deploy

1.7k views Asked by At

i'm building my web service project with maven.

In my pom.xml i have :

<packaging>war</packaging>

This result in having my .war deployed in nexus.

But i also want to extract a jar from a subset of classes of this project using builder-helper-maven-plugin :

The jar creation which result in creating ws-webservice.jar in target :

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.5</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <includes>
                    <include>org/xxx/ws/yyy/config/**/*</include>
                    <include>org/xxx/ws/yyy/domain/**/*</include>
                    <include>org/xxx/ws/yyy/jpa/**/*</include>
                </includes>
            </configuration>
        </plugin>

The build-helper-maven-plugin execution :

            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-artfact</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                        <artifact>
                            <file>target/ws-webservice.jar</file>
                            <type>jar</type>
                        </artifact>
                        </artifacts>
                    </configuration>
                </execution>

With this configuration, only the .jar is deployed in nexus and the war is no longer deployed.

Any idea ?`

EDIT

I managed to deploy the jar and the war to nexus using

<artifact>
   <classifier>dao-jpa</classifier>
   <file>target/ws-webservice.jar</file>
   <type>jar</type>
</artifact>

This results in ws-webservice-1.0.0-SNAPSHOT.war and ws-webservice-1.0.0-SNAPSHOT.dao-jpa.jar. Of course, the classifier is mandatory in this case.

The good way is probably to go for a maven parent project enclosing the dao layer and the webservice in 2 different child projects.

0

There are 0 answers