Maven pom项目部署
Posted energy1010
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Maven pom项目部署相关的知识,希望对你有一定的参考价值。
maven控制台运行程序
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1-beta-1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.package.MainClass</mainClass>
<arguments>
<argument>arg1</argument>
<argument>arg2</argument>
</arguments>
</configuration>
</plugin>
配置开发者信息
<developers>
<developer>
<id>eric</id>
<name>Eric</name>
<email>[email protected]</email>
<url>http://eric.propellors.net</url>
<organization>Codehaus</organization>
<organizationUrl>http://mojo.codehaus.org</organizationUrl>
<roles>
<role>architect</role>
<role>developer</role>
</roles>
<timezone>-6</timezone>
<properties>
<picUrl>http://tinyurl.com/prv4t</picUrl>
</properties>
</developer>
</developers>
Contributors
<contributors>
<contributor>
<name>Noelle</name>
<email>[email protected]</email>
<url>http://energy1010.com</url>
<organization>Energy1010</organization>
<organizationUrl>http://energy1010.com</organizationUrl>
<roles>
<role>tester</role>
</roles>
<timezone>-5</timezone>
<properties>
<gtalk>[email protected]</gtalk>
</properties>
</contributor>
</contributors>
Mailing Lists
<mailingLists>
<mailingList>
<name>User List</name>
<subscribe>[email protected]</subscribe>
<unsubscribe>[email protected]</unsubscribe>
<post>[email protected]</post>
<archive>http://127.0.0.1/user/</archive>
<otherArchives>
<otherArchive>http://base.google.com/base/1/127.0.0.1</otherArchive>
</otherArchives>
</mailingList>
</mailingLists>
Distribution Management
用于配置分发管理,配置相应的产品发布信息,主要用于发布,在执行mvn deploy后表示要发布的位置
1 配置到文件系统
<distributionManagement>
<repository>
<id>proficio-repository</id>
<name>Proficio Repository</name>
<url>file://${basedir}/target/deploy</url>
</repository>
</distributionManagement>
2 使用ssh2配置
<distributionManagement>
<repository>
<id>proficio-repository</id>
<name>Proficio Repository</name>
<url>scp://sshserver.yourcompany.com/deploy</url>
</repository>
</distributionManagement>
3 使用sftp配置
<distributionManagement>
<repository>
<id>proficio-repository</id>
<name>Proficio Repository</name>
<url>sftp://ftpserver.yourcompany.com/deploy</url>
</repository>
</distributionManagement>
4 使用外在的ssh配置
编译扩展用于指定使用energy1010外在ssh提供,用于提供你的文件到相应的远程服务器。
<distributionManagement>
<repository>
<id>proficio-repository</id>
<name>Proficio Repository</name>
<url>scpexe://sshserver.yourcompany.com/deploy</url>
</repository>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.energy1010</groupId>
<artifactId>energy1010-ssh-external</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build>
5 使用ftp配置
<distributionManagement>
<repository>
<id>proficio-repository</id>
<name>Proficio Repository</name>
<url>ftp://ftpserver.yourcompany.com/deploy</url>
</repository>
</distributionManagement>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.energy1010</groupId>
<artifactId>energy1010-ftp</artifactId>
<version>1.0-alpha-6</version>
</extension>
</extensions>
</build>
repository 对应于你的开发库,用户信息通过settings.xml中的server取得
Profiles
类似于settings.xml中的profiles,增加了几个元素,如下的样式:
<profiles>
<profile>
<id>test</id>
<activation>...</activation>
<build>...</build>
<modules>...</modules>
<repositories>...</repositories>
<pluginRepositories>...</pluginRepositories>
<dependencies>...</dependencies>
<reporting>...</reporting>
<dependencyManagement>...</dependencyManagement>
<distributionManagement>...</distributionManagement>
</profile>
</profiles>
以上是关于Maven pom项目部署的主要内容,如果未能解决你的问题,请参考以下文章