Intellij IDEA为Maven私有仓库与Resin搭建集成开发环境
开头先用图示的方式介绍一下Maven中央仓库、私有服务器、与本地仓库的关系,如下图:
上面非常直观的解释他们这三者之间的关系,本人就不再详细展开说明,不明白的请自行Google :)
下面直接进入主题,因为项目需要使用Maven中央仓库与私有仓库的jar包并要运行Resin中,同时采用直接部署代码的方式而非用war包的方式部署项目。
下面我详细是一下配置方法:
按照惯例,先介绍一下开发环境版本:
OS:windows 7
IDE:Intellij IDEA 2016.3.4;
Build Automation:Apache Maven 3.2.5;
Server:Resin-3.1.14;
我这里不介绍如何安装Intellij IDEA、Maven、Resin,不会的请自行Google;
(1)配置Maven私有仓库,让Intellij IDEA(以下简称idea)根据Maven全局配置文件自动识别私有仓库地址,并自动下载项目中依赖的jar包;
[xml]
<profiles>
<profile>
<!– profile的唯一标识 –>
<id>Test</id>
<!– 远程仓库列表 –>
<repositories>
<!–包含需要连接到远程仓库的信息 –>
<repository>
!–远程仓库唯一标识 –>
<id>Test</id>
<!–远程仓库名称 –>
<name>Test-Repository</name>
<url>http://url…</url>
<!–如何处理远程仓库里发布版本的下载 –>
<releases>
<!–true或者false表示该仓库是否为下载某种类型构件(发布版,快照版)开启。 –>
<enabled>true</enabled>
</releases>
<!–如何处理远程仓库里快照版本的下载。–>
<snapshots
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<!– 手动激活profiles的列表 –>
<activeProfiles>
<activeProfile>Test</activeProfile>
</activeProfiles>
[/xml]
[……]