阿里云 最新配置 直接copy就可用,阿里云换路径了
<mirrors><mirror>
<!--id, name是该镜像的唯一定义符。id用来区分不同的mirror元素。 -->
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<!--<mirrorOf>的值为星号,表示该配置是匹配所有远程仓库。 -->
<url>http://maven.aliyun.com/nexus/content/repositories/central</url>
</mirror>
</mirrors>
----------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--本地Maven仓库服务 :SSH相关配置-->
<!-- <localRepository>C:\repository</localRepository>-->
<!--本地Maven仓库服务 :SSM相关配置-->
<!-- <localRepository>C:\.m2\repository</localRepository>-->
<!--当前使用:如果使用远程仓库1.不需要指定仓库默认User\用户名\.m2\repository,2.可以指定本地仓库下载位置 -->
<localRepository>D:\ALocal\Maven_Jars</localRepository>
<pluginGroups></pluginGroups>
<proxies></proxies>
<!--配置参考:
http://www.sojson.com/blog/168.html | Maven基础
http://blog.csdn.net/haohaizijhz/article/details/72841489 | Maven配置多仓库镜像
http://blog.csdn.net/caomiao2006/article/details/40401517 | mirror和repository 区别
http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/maven-skill-introduce.html | IntelliJ IDEA 配合 Maven 的一些技巧
-->
<!--阿里云中央Maven云服务-->
<mirrors>
<mirror>
<!--id, name是该镜像的唯一定义符。id用来区分不同的mirror元素。 -->
<id>aliyun</id>
<name>aliyun maven</name>
<!--url是该镜像的URL。构建系统会优先考虑使用该URL,而非使用默认的服务器URL。 -->
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<!--<mirrorOf>的值为星号,表示该配置是匹配所有远程仓库。 -->
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
<!-- 如果有搭建自己公司的maven私服,公司内部会把自己的公司的公共jar包上传到maven私服中。
如果私服配置了上传权限,servers标签需要给出授权信息。
使用方法
1.在maven的工程中,pom中使用ditributionManagement标签私服地址。
<distributionManagement>
<repository>
<id>release-repository</id>
<name>Release Repository</name>
<url>http://www.myrepository.com/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshot-repository</id>
<name>Snapshot Repository</name>
<url>http://www.myrepository.com/repositories/snapshots</url>
</snapshotRepository></distributionManagement>
上面的例子,我们公司的私服地址是http://www.myrepository.com,配置了SNAPSHOT包的上传路径和RELEASE包的上传路径。
2.在maven的settings.xml中配置servers。
<servers>
<server>
<id>snapshot-repository</id>
<username>snapshot</username>
<password>123456</password>
</server>
<server>
<id>release-repository</id>
<username>release</username>
<password>123456</password>
</server></servers>
需要注意的是两处的id需要相互匹配。
帐号的权限都是私服配置的。上传到SNAPSHOT还是RELEASE是由项目的version决定的。
也可以使用ssh key的方式配置servers。-->
<!--如果该镜像仓库需要认证,则配置setting.xml中的<server></server>即可。-->
<servers></servers>
<profiles>
<!--1.下载源码的配置-->
<profile>
<id>aliyun</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
<!--1.下载源码的配置-->
</profiles>
<!--当前使用的远程仓库名称-->
<activeProfiles>
<activeProfile>aliyun</activeProfile>
</activeProfiles>
<!--当前使用的远程仓库名称-->
</settings>
<!-----------------------------------------POM配置------------------------------------>
<!-- 配置Maven插件将Maven依赖的Jar全部导出到target/lib -->
<!-- 将依赖Maven_Jar导出 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
----------------------------------------------------------------------------------------------------------
<build>
<finalName>help</finalName>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy</id>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="******************** gitbook build... ********************"></echo>
<echo message="-- node dir : ${project.basedir}\node"/>
<echo message="-- build dir: ${project.build.directory}"/>
<exec dir="${project.basedir}\node" executable="cmd.exe">
<arg line="/c build.bat"/>
<arg line="/c exit"/>
</exec>
<copy todir="${project.basedir}/src/main/webapp/doc" overwrite="true">
<fileset dir="${project.basedir}\node\_book">
<exclude name="**/*.md"/>
</fileset>
</copy>
</tasks>
</configuration>
</execution>
<execution>
<id>delete</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="*****clean*****"/>
<delete dir="${project.basedir}/src/main/webapp/doc"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceExcludes>**/*.js,**/*.css</warSourceExcludes>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/webapp</directory>
</resource>
</webResources>
<warName>help</warName>
</configuration>
</plugin>
</plugins>
</build>