Maven私服配置简介(Eclipse端)
2017-05-09 00:00
381 查看
Maven 私服配置
1、settings.xml 文件配置
需要增加如下内容,这里的重点是私有云的设置,注意不要设置反啦!
注意:如果在settings.xml中配置了上文的<profile>就不需要如下的配置了
2、项目 pom.xml 文件增加如下配置
需要增加如下内容
3、项目pom.xml文件增加如下配置,通过maven生产源码包和文档包并发布到私服
添加如下内容到<build><plugins>...</plugins></build>中,具体内容如下:
欢迎大家关注懒也要有正确的方式公众号
1、settings.xml 文件配置
需要增加如下内容,这里的重点是私有云的设置,注意不要设置反啦!
<!-- 阿里云 --> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror> <!-- 私有云 --> <mirror> <id>neo4j</id> <name>neo4j</name> <url>http://xxx.xx.xx.xxx:8081/repository/neo4j/</url> <mirrorOf>alimaven</mirrorOf> <!-- 注意这里的配置,要让私有云镜像阿里云 --> </mirror> <!-- 私有云用户名、密码 --> <servers> <server> <id>maven-releases</id> <username>admin</username> <password>xxxxxxxxxx</password> </server> <server> <id>maven-snapshots</id> <username>admin</username> <password> xxxxxxxxxx</password> </server> </servers> <!-- 发布部署到私服 --> <!-- 把这段放到settings.xml文件的<profiles></profiles>中,好处是,就不用每个工程的pom项目都加啦, 而且也安全,打包里不存在私服信息 --> <profile> <id>neo4j</id> <repositories> <repository> <id>maven-releases</id> <name>maven-releases</name> <url>http://xxx.xx.xx.xxx:8081/repository/maven-releases/</url> </repository> <repository> <id>maven-snapshots</id> <name>maven-snapshots</name> <url>http://xxx.xx.xx.xxx:8081/repository/maven-snapshots/</url> </repository> </repositories> </profile>
注意:如果在settings.xml中配置了上文的<profile>就不需要如下的配置了
2、项目 pom.xml 文件增加如下配置
需要增加如下内容
<!-- 部署到私服 --> <distributionManagement> <repository> <id>maven-releases</id> <name>maven-releases</name> <url>http://xxx.xx.xx.xxx:8081/repository/maven-releases/</url> </repository> <snapshotRepository> <id>maven-snapshots</id> <name>maven-snapshots</name> <url>http://xxx.xx.xx.xxx :8081/repository/maven-snapshots/</url> </snapshotRepository> </distributionManagement>
3、项目pom.xml文件增加如下配置,通过maven生产源码包和文档包并发布到私服
添加如下内容到<build><plugins>...</plugins></build>中,具体内容如下:
<!-- 生成javadoc文档包的插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.10.4</version> <configuration> <aggregate>true</aggregate> </configuration> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <!-- 生成sources源码包的插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>3.0.1</version> <configuration> <attach>true</attach> </configuration> <executions> <execution> <!-- execution下可配置phase属性, 意思是在什么阶段打包源文件。如package --> <phase>package</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin>
欢迎大家关注懒也要有正确的方式公众号
相关文章推荐
- Maven、eclipse与Nexus私服配置指南
- [使用心得]maven2之m2eclipse使用手册之一简介与配置文件settings.xml
- eclipse 配置maven插件 以及nuxus 搭建本地私服仓库
- 阿里云搭建Maven私服配置网页端操作简介
- Maven简介、下载安装和Eclipse配置
- Maven简介和环境变量配置和集成Eclipse
- maven安装及eclipse配置
- windows下集成maven+eclipse开发环境一:安装使用maven私服nexus
- Linux安装配置maven3.0以及搭建nexus私服
- Linux安装配置maven3.0以及搭建nexus私服
- Maven简介及eclipse安装Maven插件
- eclipse 配置maven 项目
- eclipse 配置maven web项目
- 在Eclipse配置 Maven方法
- Maven的使用,Nexus建立本地仓库以及Eclipse导入Maven项目(三): 配置篇
- eclipse中安装与配置Maven
- maven私服的配置
- windows 下 eclipse 里面的 maven 配置
- [使用心得]maven2之m2eclipse使用手册之三第一个Simple MavenProject与Pom.xml配置说明
- Eclipse开发环境中使用maven插件的配置备忘