Maven基本配置
By:wendal<wendal1985@gmail.com>

Nutz核心jar

Top

nutz及周边插件,均已发布到maven中央库库,可以直接配置使用

<dependency>
	<groupId>org.nutz</groupId>
	<artifactId>nutz</artifactId>
	<version>1.r.65</version>
</dependency>

快照库地址 https://jfrog.nutz.cn/artifactory/snapshots

快照库内包含nutz主库,插件库,等快照jar

常用配置模板

Top

新建项目的参考配置,nutz+mysql+druid,并应用了nutzcn提供的maven镜像服务及快照库.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroupId</groupId>
<artifactId>myartifactId</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
	<!-- UTF8大法好 -->
	<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
	<!-- 核心jar -->
	<dependency>
		<groupId>org.nutz</groupId>
		<artifactId>nutz</artifactId>
		<version>1.r.65</version>
	</dependency>
	<!-- mysql驱动 -->
	<dependency>
		<groupId>mysql</groupId>
		<artifactId>mysql-connector-java</artifactId>
		<version>5.1.44</version>
	</dependency>
	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>javax.servlet-api</artifactId>
		<version>3.1.0</version>
		<scope>provided</scope>
	</dependency>
	<!-- Druid连接池 -->
	<dependency>
		<groupId>com.alibaba</groupId>
		<artifactId>druid</artifactId>
		<version>1.1.5</version>
	</dependency>
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>4.12</version>
		<scope>test</scope>
	</dependency>
</dependencies>
<build>
	<plugins>
		<plugin>
			<artifactId>maven-compiler-plugin</artifactId>
			<version>3.3</version>
			<configuration>
				<source>1.8</source>
				<target>1.8</target>
				<compilerArgs>
					<arg>-parameters</arg>
				</compilerArgs>
				<useIncrementalCompilation>false</useIncrementalCompilation>
			</configuration>
		</plugin>
	</plugins>
</build>
<repositories>
	<repository>
		<id>nutz</id>
		<url>http://jfrog.nutz.cn/artifactory/libs-release</url>
		<snapshots>
			<enabled>false</enabled>
		</snapshots>
	</repository>
	<repository>
		<id>nutz-snapshots</id>
		<url>http://jfrog.nutz.cn/artifactory/snapshots</url>
		<snapshots>
			<enabled>true</enabled>
			<updatePolicy>always</updatePolicy>
		</snapshots>
		<releases>
			<enabled>false</enabled>
		</releases>
	</repository>
</repositories>
</project>

特别提醒

Top

如果配置过镜像库,例如阿里的镜像库, 你的settings.xml里面也许有这样的配置,注意星号

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>*</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>

这个配置是错误的, 星号代表全部,无论是release还是snapshots都代理, 会导致所有第三方快照库的设置都失效. 要改成

<mirror>
    <id>nexus-aliyun</id>
    <mirrorOf>central</mirrorOf>
    <name>Nexus aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>