mvn deploy的时候会出现以下错误:

Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter

意思是在pom文件中缺少distributionManagement标签,或者缺少-DaltDeployementRepositoty,说的是缺少deploy的地址,maven不知道你想要deploy到哪里,在pom文件中增加如下信息,就发布成功了.

<distributionManagement>  
        <repository>  
            <id>nexus</id>  
            <name>releases</name>  
            <url>http://mvn2.qdingnet.com/nexus/content/repositories/releases</url>  
            <uniqueVersion>true</uniqueVersion>  
        </repository>  
        <snapshotRepository>  
            <id>nexus</id>  
            <name>snapshots</name>  
            <url>http://XXXXXXXXXXXXX/nexus/content/repositories/snapshots</url>  
        </snapshotRepository>  
    </distributionManagement>