Maven: Avoid deploying an artifact implying a project implementation during the standard assembly life cycle

Is it possible to avoid deploying an artifact that is built in accordance with the packaging of the project during the "expand: expand" processing?

I mean the following:

  • Suppose we have “pom.xml” for a web application and define the type of packaging as “war”;
  • we want to collect the artifact '* .war' or '* .zip' that contains our application, as well as the servlet container;
  • we want to deploy only this artifact "* .zip" during processing "deploy: deploy";

those. I want to be able to run "mvn deploy" and has the following results:

  • 'myapp.war' is constructed;
  • 'myapp-standalone.zip' is constructed;
  • 'myapp-standalone.zip' is deployed to the target remote repository (note that I am not worried if myapp.war is installed here in the local repository);

I checked 'war: war documentation' and found the primaryArtifact parameter. However, it only mentions the local repository.

I tried the following POM, but it still deploys either "* .war" or "* .zip" in the remote repository:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mygroup</groupId>
    <artifactId>myapp</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>myapp</name>
    <url>http://maven.apache.org</url>

    <dependencies>
        <!-- dependencies go here -->
    </dependencies>

    <build>
        <plugins>
            <! -- plugins like 'compiler' etc -->

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <primaryArtifact>false</primaryArtifact>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>myapp-standalone</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/standalone.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <repository>
            <-- target repository information -->
        </repository>
        <snapshotRepository>
            <-- target repository information -->
        </snapshotRepository>
    </distributionManagement>
</project>

, , "pom" , "war" ( "resources: resources", "compiler: compile", "resources: testResources", : testCompile ',' surefire: test ',' war: war ',' install: install ',' deploy: deploy '). POM , .

, Maven - , , . , Maven, , (, *.zip).

?

,

+5
1

Maven Deploy Plugin:

deploy: deploy , pom , . [...]

, " ".

, ( ) :

         <plugin>
           <artifactId>maven-deploy-plugin</artifactId>
           <version>X.Y</version>
           <configuration>
             <skip>true</skip>
           </configuration>
         </plugin>
+8

All Articles