【工具】MAVEN

1.MAVEN

<settings>
	<servers>
		<server>
			<id>releases</id>
			<username>XXX</username>
			<password>XXX</password>
		</server>
		<server>
			<id>Snapshots</id>
			<username>XXX</username>
			<password>XXX</password>
		</server>
	</servers>
	<offline>false</offline>
	<mirrors>
		<mirror>
			<!--This sends everything else to /public -->
			<id>nexus</id>
			<mirrorOf>*</mirrorOf>
			<url>http://XXX.com:8058/nexus/content/groups/public</url>
		</mirror>
		<mirror>
			<!--This is used to direct the public snapshots repo in the profile below 
				over to a different nexus group -->
			<id>nexus-public-snapshots</id>
			<mirrorOf>public-snapshots</mirrorOf>
			<url>http://XXX:8058/nexus/content/repositories/snapshots
			</url>
        </mirror>
                <mirror>
        <!--This sends everything else to /public -->
        <id>nexus-aliyun</id>
        <mirrorOf>*</mirrorOf>
        <name>Nexus aliyun</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </mirror>
	</mirrors>

	<profiles>
		<profile>
			<id>development</id>
			<repositories>
				<repository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>central</id>
					<url>http://central</url>
					<releases>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
		<profile>
			<!--this profile will allow snapshots to be searched when activated -->
			<id>public-snapshots</id>
			<repositories>
				<repository>
					<id>public-snapshots</id>
					<url>http://public-snapshots</url>
                    <releases>
                              <!--x修改-->
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</repository>
			</repositories>
			<pluginRepositories>
				<pluginRepository>
					<id>public-snapshots</id>
					<url>http://public-snapshots</url>
                    <releases>
                              <!--xiugai -->
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</releases>
					<snapshots>
						<enabled>true</enabled>
						<updatePolicy>always</updatePolicy>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	<activeProfiles>
		<activeProfile>development</activeProfile>
		<activeProfile>public-snapshots</activeProfile>
	</activeProfiles>

</settings> 

二 命令

1.package install deploy

  • package命令完成了项目编译、单元测试、打包功能,但没有把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库和远程maven私服仓库
  • install命令完成了项目编译、单元测试、打包功能,同时把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库,但没有布署到远程maven私服仓库
  • deploy命令完成了项目编译、单元测试、打包功能,同时把打好的可执行jar包(war包或其它形式的包)布署到本地maven仓库和远程maven私服仓库

2.clean

clean选项将工程中的.class文件删除,同时重新编译工程,

3.下载源码包

–fail-never 错误继续执行

mvn dependency:sources -Dclassifier=javadoc -U --fail-never -Dmaven.test.skip=true

4.mvn -u

-U,--update-snapshots Forces a check for missing releases
and updated snapshots on remote repositories

意思是:强制刷新本地仓库不存在release版和所有的snapshots版本。
对于release版本,本地已经存在,则不会重复下载
对于snapshots版本,不管本地是否存在,都会强制刷新,但是刷新并不意味着把jar重新下载一遍。只下载几个比较小的文件,通过这几个小文件确定本地和远程仓库的版本是否一致,再决定是否下载

5.maven参数:

  • -DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下。
  • -Dmaven.test.skip=true,不执行测试用例,也不编译测试用例类。

6.常用方式

⑴打包
mvn clean package -DskipTests
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值