Maven的日常
- 强烈建议把 Maven 的 settings.xml 文件同时放在:
%USER_HOME%/.m2/settings.xml和${maven.home}/conf/settings.xml两个地方。避免使用终端的时候默认去调用用户目录下的。
【idea侧边栏上Maven的Profile怎么用的】
http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/maven-skill-introduce.html
更多 只使用阿里云仓库的setting.xml配置、使用nexus私有仓库+阿里云仓库的settings.xml配置。(自己日常是用阿里云镜像。)
【profile】为了解决不同环境所需的不同变量、配置等问题。
- profile 一般可以在三个地方:settings.xml(仓库),pom.xml(dev和prod),profiles.xml(这个不常用)
在 settings.xml 上,一般大家用来做仓库的选择,设置全局的 profile,一个是 nexus 仓库,一个是 aliyun 仓库,默认激活的是 nexus 仓库。(activeProfiles)
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository>D:\maven\my_local_repository</localRepository> <pluginGroups>
</pluginGroups> <proxies>
</proxies> <profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://192.168.1.73:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>nexus</id>
<url>http://192.168.1.73:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>aliyun</id>
<repositories>
<repository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>aliyun</id>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles> <activeProfiles>
<activeProfile>nexus</activeProfile>
</activeProfiles> </settings>
在 pom.xml 中,一般用来激活环境配置(打包的时候,默认是 dev 模式,打包 src/main/env/dev 下的配置文件,如果选择 product 则打包 src/main/env/product 下的配置文件)
<profiles>
<profile>
<id>dev</id>
<properties>
<package.environment>dev</package.environment>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/env/${package.environment}</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<finalName>${project.artifactId}</finalName>
</build>
</profile>
<profile>
<id>product</id>
<properties>
<package.environment>product</package.environment>
</properties>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/env/${package.environment}</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
<finalName>${project.artifactId}</finalName>
</build>
</profile>
</profiles>
Maven的日常的更多相关文章
- Maven日常 —— 你应该知道的一二三
以前在日常工作中,使用Maven只是机械的执行Maven clean.Maven install,对其中的原理与过程并无了解,近期阅读了<Maven实战>,对Maven有了更深入的理解. ...
- (十二)Maven生命周期和插件
除了坐标.依赖以及仓库之外,Maven的另外两个核心概念是生命周期和插件.在有关Maven的日常使用中,命令行的输入往往就对应了生命周期,如mvn package就表示执行默认生命周期阶段packag ...
- Nexus 私有仓库搭建与 Maven 集成
Nexus 私有仓库搭建与 Maven 集成 |作者:RexFang |出处:http://www.cnblogs.com/rexfang/ |关于作者:Java 程序员一枚 |版权:本文版权归作者和 ...
- Maven快照机制(SNAPSHOT)
文章转自 http://www.cnblogs.com/EasonJim/p/6852840.html 以下引用自https://ayayui.gitbooks.io/tutorialspoint-m ...
- 05 Maven 生命周期和插件
Maven 生命周期和插件 除了坐标.依赖以及仓库之外, Maven 另外两个核心概念是生命周期和插件.在有关 Maven 的日常使用中,命令行的输入往往就对应了生命周期,如 mvn package ...
- maven+springboot项目使用idea打包
首先简单了解一下maven: 概述 日常开发中,我们用到的maven相关功能大概以下几种: 1. 管理jar依赖 2. 构建项目(打包.编译等) 3. 发布项目(共享.上传至服务器,供他人使用) 简单 ...
- Maven之——仓库(下)
Maven之--仓库(下) 1. 快照版本号 Maven世界中不论什么项目或者构件都有自己的版本号. Maven在构建时检測到构件是快照版本号.而且当前构件不是最新版本号的时候.就会自己主动更新 ...
- Java-Maven-Runoob:Maven 快照(SNAPSHOT)
ylbtech-Java-Maven-Runoob:Maven 快照(SNAPSHOT) 1.返回顶部 1. Maven 快照(SNAPSHOT) 一个大型的软件应用通常包含多个模块,并且通常的场景是 ...
- Maven一些总结
1.Maven的安装和配置 从Maven的官网上下载Maven的安装包,http://maven.apache.org/download.html. 将其解压在你想安放的目录下. 然后配 ...
随机推荐
- Markdown基础(内含:锚点使用,使用HTML,新页面跳转,目录生成)
Github样式显示参考:点我 之前说过用word写文章,这次说说Markdown写文章(推荐) 逆天推荐使用VSCode编写 装这个插件写作更方便: 内含:锚点使用,使用HTML,新页面跳转,目录生 ...
- Ubuntu18.04搜狗输入法最新版本2.2.0.0108经常乱码的解决方案
图示 解决 旧版 可以安装旧版(我只在新版sogoupinyin_2.2.0.0108_amd64才遇到这个问题) 旧版安装指南:http://www.cnblogs.com/dunitian/p/6 ...
- 网页发起qq临时会话
qq官方:http://shang.qq.com/v3/widget.html
- css 蒙层
蒙层 利用z-index: .mui-backdrop-other { position: fixed; top: 44px; right:; bottom:; left:; z-index:; ba ...
- System.Web.Optimization对脚本和样式表的压缩操作
1 是否允许样式表压缩 BundleTable.EnableOptimizations = true; 在MVC项目中的 BundleConfig操作中是微软已经给我们准备好的CSS和JS压缩,我们可 ...
- 跟我一起写一个hello-world react组件并发布到npm
第一步:初始化我们的配置 $ mkdir react-hello-world $ cd react-hello-world/ $ npm init -y 修改我们的package.json文件 //p ...
- python3+django2 开发易语言网络验证(下)
第六步:网络验证服务器端项目上线部署 功夫不负有心人,终于部署成功啦! 前期准备: 项目名:netauth 系统:百度云服务器下的Ubuntu16.4 软件:xshell(无论如何想办法用这个跟服务器 ...
- django基于存储在前端的token用户认证
一.前提 首先是这个代码基于前后端分离的API,我们用了django的framework模块,帮助我们快速的编写restful规则的接口 前端token原理: 把(token=加密后的字符串,key= ...
- 动态代理之: com.sun.proxy.$Proxy0 cannot be cast to 问题
转: 动态代理之: com.sun.proxy.$Proxy0 cannot be cast to 问题 2018年05月13日 00:40:32 codingCoge 阅读数:1211 版权声明 ...
- Counted(内存管理机制)
class Counted { private: unsigned int count_; public: Counted() : count_() { } virtual ~Counted() { ...