How to deploy only zip artifacts in maven

风格不统一 提交于 2019-12-04 04:54:06

First you have to fix you error in distributionManagement area like this:

  <distributionManagement>
    <snapshotRepository>
        <id>wvoNexus</id>
        <url>http://nexus.corproot.com/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>

    <repository>
        <id>wvoNexus</id>
        <url>http://nexus.corproot.com/nexus/content/repositories/releases/</url>
    </repository>
  </distributionManagement>

If you fixed that you can simple deploy the files to your nexus via:

mvn clean deploy

If you don't like having a jar deployed as well you need to change the packing type in your pom like this:

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.wyndhamvo.prototype.dbscripts</groupId>
  <artifactId>DB_SCRIPTS</artifactId>
  <version>2.0.0.1</version>
  <packaging>pom</packaging>


    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptor>src/assembly/descriptor.xml</descriptor>
                </configuration>
                <executions> 
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

Furthermore i recommend to define the versions of your used plugins like this:

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <descriptor>src/assembly/descriptor.xml</descriptor>
                </configuration>
                <executions> 
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

You made a mistake: the <file/> element is not a part of <snapshotRepository/>, it's an config item of deploy plugin! you should deploy your zip file as following:

mvn -X clean package deploy:deploy-file -Dfile=/path/to/your-artifact-1.0.zip
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!