Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on p

来源:互联网 发布:林若宁 知乎 编辑:程序博客网 时间:2024/06/07 18:34

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project zxsd-app: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]


发布本地项目到远程nexus私服抛了异常,这个提示意思是本项目不知道发不到哪个仓库,需要指明,项目是发布到哪个仓库id的


修改maven的settings.xml你要发布到哪个仓库,需要这个仓库的权限,snapshot,这个是吧快照的war或者jar上传到snapshot仓库,releases把稳定版本的war或jar上传到releases仓库



    <modelVersion>4.0.0</modelVersion>
    <groupId>com.zxsd</groupId>
    <artifactId>zxsd-app</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>
        <!-- 配置远程发布到私服,mvn deploy -->
    <distributionManagement>
        <repository>  
            <id>releases</id>  
            <name>Nexus Release Repository</name>  
            <url>http://192.168.1.122:8081/nexus/content/repositories/releases/</url>  
        </repository>  
        <snapshotRepository>  
            <id>snapshots</id>  
            <name>Nexus Snapshot Repository</name>  
            <url>http://192.168.1.122:8081/nexus/content/repositories/snapshots/</url>  
        </snapshotRepository>
    </distributionManagement>


这个是你要上传项目的pom配置,version后缀为SNAPSHOT是需要上传到snapshots库的

            <id>snapshots</id>  
            <name>Nexus Snapshot Repository</name>  
            <url>http://192.168.1.122:8081/nexus/content/repositories/snapshots/</url> 
这段就是控制上传到私有库的代码




eclipse上传 该项目 上传成功


0 0
原创粉丝点击