配置Nexus-Maven本地仓库

2017/11/14 10:28
阅读数 841

1、下载nexus

进入:http://www.sonatype.org/nexus/downloads/ 
这里写图片描述 
说明: 
[OSS = Open Source Software,开源软件 – 免费] 
[FREE TRIAL,专业版本 – 收费]

这里写图片描述

2、Centos下安装Nexus

安装JDK,此处略,检查自己虚拟机上的JDK版本如下: 
这里写图片描述

使用xftp将nexus上传到:/home/tuzq/software 
首先解压下载到的文件:

[root@hadoop10 software]# tar -zxvf nexus-3.6.0-02-unix.tar.gz
[root@hadoop10 software]# ls
apache-maven-3.5.0-bin.tar.gz  azkaban-sql         jdk-8u73-linux-x64.tar.gz  nexus-3.6.0-02-unix.tar.gz  solr-4.10.3.tgz.tgz
apache-tomcat-8.5.12.tar.gz    incubator-rocketmq  nexus-3.6.0-02             solr-4.10.3                 sonatype-work

这里写图片描述

编辑环境变量

[root@hadoop10 software]# vi /etc/profile

添加Nexus的路径,一定要注意路径不能错 
这里写图片描述

修改完成之后,最后执行下面的命令:

[root@hadoop10 bin]# source /etc/profile

修改nexus-3.6.0-02下的bin/nexus.rc文件

[root@hadoop10 bin]# vim nexus.rc

设置启动该服务的用户,Nexus不推荐使用root,这里暂时设置为root

run_as_user="root"

添加服务

[root@hadoop10 bin]# sudo ln -s $NEXUS_HOME/bin/nexus /etc/init.d/nexus

启动nexus

[root@hadoop10 init.d]# service nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus
[root@hadoop10 init.d]#

到这里就算是启动完毕,log信息可以在下面的文件中查看:

[root@hadoop10 init.d]# cd /home/tuzq/software/sonatype-work/nexus3/log/
[root@hadoop10 log]# ls
jvm.log  karaf.log  nexus.log
[root@hadoop10 log]#

默认端口是8081 
默认用户名是admin,密码admin123 
修改端口在:/home/tuzq/software/nexus-3.6.0-02/etc/nexus-default.properties

在浏览器中访问:http://192.168.106.100:8081/ 
这里写图片描述

3、apache-maven-3.3.9\conf\setting.xml配置案例

<?xml version="1.0" encoding="UTF-8"?>

<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">
    <!-- Linux环境下的setting -->
    <localRepository>E:/maven_repo</localRepository>
    <interactiveMode>true</interactiveMode>
    <offline>false</offline>
    <pluginGroups>
        <pluginGroup>org.mortbay.jetty</pluginGroup>
        <pluginGroup>org.jenkins-ci.tools</pluginGroup>
    </pluginGroups>

    <!--配置权限,使用默认用户-->
    <servers>
        <server>
            <id>maven-central</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>maven-public</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>maven-releases</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
        <server>
            <id>maven-snapshots</id>
            <username>admin</username>
            <password>admin123</password>
        </server>
    </servers>

    <mirrors>

    </mirrors>

    <profiles>
        <profile>
            <id>setting</id>
            <activation>
                <activeByDefault>false</activeByDefault>
                <jdk>1.8</jdk>
            </activation>
            <repositories>
                <!-- 私有库地址-->
                <repository>
                    <id>maven-public</id>
                    <url>http://192.168.106.100:8081/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>maven-snapshots</id>
                    <url>http://192.168.106.100:8081/repository/maven-snapshots/</url>
                    <releases>
                            <enabled>true</enabled>
                    </releases>
                    <snapshots>
                            <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>maven-releases</id>
                    <url>http://192.168.106.100:8081/repository/maven-releases/</url>
                    <releases>
                            <enabled>true</enabled>
                    </releases>
                    <snapshots>
                            <enabled>true</enabled>
                    </snapshots>
                </repository>
                <repository>
                    <id>maven-central</id>
                    <url>http://192.168.106.100:8081/repository/maven-central/</url>
                    <releases>
                            <enabled>true</enabled>
                    </releases>
                    <snapshots>
                            <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories>
                <!--插件库地址-->
                <pluginRepository>
                    <id>maven-public</id>
                    <url>http://192.168.106.100:8081/repository/maven-public/</url>
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                   </snapshots>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        <profile>  
            <id>jdk18</id>  
            <activation>  
                <activeByDefault>true</activeByDefault>  
                <jdk>1.8</jdk>  
            </activation>  
            <properties>  
                <maven.compiler.source>1.8</maven.compiler.source>  
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
            </properties>   
        </profile>

    </profiles>

    <!--激活profile-->
    <activeProfiles>
        <activeProfile>setting</activeProfile>
    </activeProfiles>   
</settings>

4、一个root-pom的pom.xml配置案例

<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>projectname</groupId>
    <artifactId>root-pom</artifactId>
    <version>0.0.1-RELEASES</version>
    <packaging>pom</packaging>

    <name>root-pom</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <!-- compiler插件, 设定JDK版本 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>


                <!-- resource插件, 设定编码 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>

            </plugins>
        </pluginManagement>
    </build>

    <distributionManagement>
        <repository>
            <id>maven-release</id>
            <name>Nexus Release Repository</name>
            <url>http://192.168.106.100:8081/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>maven-snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://192.168.106.100:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>
</project>

5、parent-pom的pom.xml配置案例

<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>

    <parent>
        <groupId>projectname</groupId>
        <artifactId>root-pom</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <artifactId>parent-pom</artifactId>
    <packaging>pom</packaging>

    <name>parent-pom</name>
    <url>http://maven.apache.org</url>

    <modules>
        <module>../root-pom</module>

        <module>parent-web</module>
        <module>parent-bl</module>
        <module>parent-dao</module>
        <module>parent-webapp</module>

        <module>../projectname-core</module>
        <module>../projectname-core-service</module>
        <module>../projectname-web</module>
        <module>../projectname-redis</module>
        <module>../projectname-mysql</module>
        <module>../projectname-service-base</module>
        <module>../projectname-qx</module>

        <module>../usr</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.3.10.RELEASE</spring.version>
        <spring-session.version>1.3.1.RELEASE</spring-session.version>
        <spring-data-redis.version>1.8.6.RELEASE</spring-data-redis.version>
        <spring-data-hadoop.version>2.4.0.RELEASE</spring-data-hadoop.version>
        <spring-data-hadoop-hbase.version>2.4.0.RELEASE</spring-data-hadoop-hbase.version>
        <hbase-client.version>1.3.0</hbase-client.version>
        <redis.clients.version>2.9.0</redis.clients.version>
        <mybatis.version>3.3.0</mybatis.version>
        <mybatis-spring.version>1.2.3</mybatis-spring.version>
        <mysql-connector-java.version>5.1.40</mysql-connector-java.version>
        <dubbo.version>2.5.3</dubbo.version>
        <druid.version>1.1.2</druid.version>
        <slf4j.version>1.7.25</slf4j.version>
        <log4j.version>1.2.17</log4j.version>
        <poi.version>3.14</poi.version>
        <jxl.version>2.6.12</jxl.version>
        <tomcat-catalina.version>8.0.23</tomcat-catalina.version>
        <sqljdbc4.version>4.2</sqljdbc4.version>
        <zookeeper.version>3.4.10</zookeeper.version>
        <zkclient.version>0.10</zkclient.version>
        <guice.version>4.1.0</guice.version>
        <jdk.tools.version>1.8</jdk.tools.version>
        <httpclient.version>4.5.2</httpclient.version>
        <commons-httpclient.version>3.1</commons-httpclient.version>
        <httpcore.version>4.4.5</httpcore.version>
        <junit.version>4.12</junit.version>
        <jackson-databind.version>2.9.0</jackson-databind.version>
        <jstl.version>1.2</jstl.version>
        <standard.version>1.1.2</standard.version>
        <freemarker.version>2.3.23</freemarker.version>
        <javax.servlet-api.version>3.1.0</javax.servlet-api.version>
        <jspapi.version>2.2</jspapi.version>
        <commons-dbcp2.version>2.1</commons-dbcp2.version>
        <commons-codec.version>1.10</commons-codec.version>
        <commons-pool2.version>2.4.2</commons-pool2.version>
        <commons-lang3.version>3.5</commons-lang3.version>
        <commons-lang.version>2.6</commons-lang.version>
        <commons-logging.version>1.2</commons-logging.version>
        <commons-io.version>2.5</commons-io.version>
        <xstream.version>1.4.9</xstream.version>
        <pinyin4j.version>2.5.1</pinyin4j.version>
        <dom4j.version>1.6.1</dom4j.version>

        <!--操作mapper所需的公共jar-->
        <pagehelper.version>5.0.4</pagehelper.version>
        <jsqlparser.version>1.1</jsqlparser.version>
        <mapper.version>3.0.1</mapper.version>


        <joda-time.version>2.9.9</joda-time.version>

        <!--clean插件,for maven-clean-plugin-->
        <maven-clean-plugin-version>3.0.0</maven-clean-plugin-version>
        <!--编译插件 for maven compiler plugin -->
        <maven-compiler-plugin-version>3.6.0</maven-compiler-plugin-version>
        <java-source-version>1.8</java-source-version>
        <java-target-version>1.8</java-target-version>
        <!--发布插件 for maven-deploy-plugin-->
        <maven-deploy-plugin-version>2.8.2</maven-deploy-plugin-version>
        <!--打war包对应的插件 for maven-war-plugin-->
        <maven-war-plugin-version>3.1.0</maven-war-plugin-version>
        <!--安装插件 for maven-install-plugin-->
        <maven-install-plugin-version>2.5.2</maven-install-plugin-version>
        <!--单元测试插件 for maven-surefire-plugin-->
        <maven-surefire-plugin-version>2.20</maven-surefire-plugin-version>
        <!--源码插件 for maven-source-plugin-->
        <maven-source-plugin-version>3.0.1</maven-source-plugin-version>
        <!--帮助插件 for maven-help-plugin-->
        <maven-help-plugin-version>2.2</maven-help-plugin-version>
        <!--Eclipse相应插件 for maven-eclipse-plugin-->
        <maven-eclipse-plugin-version>2.10</maven-eclipse-plugin-version>
        <!--resource插件 for maven-resources-plugin -->
        <maven-resources-plugin-version>3.0.2</maven-resources-plugin-version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <!-- spring -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context-support</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${spring.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>commons-logging</groupId>
                        <artifactId>commons-logging</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-jdbc</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <artifactId>spring-oxm</artifactId>
                <groupId>org.springframework</groupId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.session</groupId>
                <artifactId>spring-session</artifactId>
                <version>${spring-session.version}</version>
            </dependency>

            <!--spring redis-->
            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-redis</artifactId>
                <version>${spring-data-redis.version}</version>
            </dependency>
            <dependency>
                <groupId>redis.clients</groupId>
                <artifactId>jedis</artifactId>
                <version>${redis.clients.version}</version>
            </dependency>

            <!--spring mybatis-->
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis-spring</artifactId>
                <version>${mybatis-spring.version}</version>
            </dependency>
            <!-- mybatis -->
            <dependency>
                <groupId>org.mybatis</groupId>
                <artifactId>mybatis</artifactId>
                <version>${mybatis.version}</version>
            </dependency>
            <!-- mysql drive -->
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>${mysql-connector-java.version}</version>
            </dependency>

            <!--apche-common包-->
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>${commons-dbcp2.version}</version>
            </dependency>
            <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>${commons-codec.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-pool2</artifactId>
                <version>${commons-pool2.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>${commons-lang3.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>${commons-logging.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>${commons-lang.version}</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>${commons-io.version}</version>
            </dependency>
            <!-- 时间操作组件 -->
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>${joda-time.version}</version>
            </dependency>

            <!-- EXCEL库 -->
            <dependency>
                <groupId>org.apache.poi</groupId>
                <artifactId>poi</artifactId>
                <version>${poi.version}</version>
            </dependency>

            <dependency>
                <groupId>net.sourceforge.jexcelapi</groupId>
                <artifactId>jxl</artifactId>
                <version>${jxl.version}</version>
            </dependency>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>${javax.servlet-api.version}</version>
                <scope>provided</scope>
            </dependency>

            <dependency>
                <groupId>javax.servlet.jsp</groupId>
                <artifactId>jsp-api</artifactId>
                <version>${jspapi.version}</version>
                <!-- <scope>provided</scope> -->
            </dependency>

            <dependency>
                <groupId>org.apache.tomcat</groupId>
                <artifactId>tomcat-catalina</artifactId>
                <version>${tomcat-catalina.version}</version>
                <scope>provided</scope>
            </dependency>

            <!-- MSSQLServer驱动 -->
            <dependency>
                <groupId>com.microsoft.sqlserver</groupId>
                <artifactId>sqljdbc4</artifactId>
                <version>${sqljdbc4.version}</version>
            </dependency>

            <!-- datasources -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>druid</artifactId>
                <version>${druid.version}</version>
            </dependency>

            <!-- dubbo相关 -->
            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>dubbo</artifactId>
                <version>${dubbo.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>spring</artifactId>
                        <groupId>org.springframework</groupId>
                    </exclusion>
                </exclusions>
            </dependency>

            <dependency>
                <groupId>org.apache.zookeeper</groupId>
                <artifactId>zookeeper</artifactId>
                <version>${zookeeper.version}</version>
            </dependency>

            <dependency>
                <groupId>com.101tec</groupId>
                <artifactId>zkclient</artifactId>
                <version>${zkclient.version}</version>
            </dependency>

            <!-- HBase相关 -->
            <dependency>
                <groupId>com.google.inject</groupId>
                <artifactId>guice</artifactId>
                <version>${guice.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-hadoop</artifactId>
                <version>${spring-data-hadoop.version}</version>
            </dependency>

            <dependency>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-hadoop-hbase</artifactId>
                <version>${spring-data-hadoop-hbase.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.hbase</groupId>
                <artifactId>hbase-client</artifactId>
                <version>${hbase-client.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpclient</artifactId>
                <version>${httpclient.version}</version>
            </dependency>

            <dependency>
                <groupId>commons-httpclient</groupId>
                <artifactId>commons-httpclient</artifactId>
                <version>${commons-httpclient.version}</version>
            </dependency>

            <dependency>
                <groupId>org.apache.httpcomponents</groupId>
                <artifactId>httpcore</artifactId>
                <version>${httpcore.version}</version>
            </dependency>

            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.1.39</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
                <version>1.9.13</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
                <version>1.9.13</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>

            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>${jackson-databind.version}</version>
            </dependency>

            <!-- 配置分页助手 -->
            <dependency>
                <groupId>com.github.pagehelper</groupId>
                <artifactId>pagehelper</artifactId>
                <version>${pagehelper.version}</version>
            </dependency>
            <dependency>
                <groupId>com.github.jsqlparser</groupId>
                <artifactId>jsqlparser</artifactId>
                <version>${jsqlparser.version}</version>
            </dependency>

            <!-- 通用Mapper -->
            <dependency>
                <groupId>com.github.abel533</groupId>
                <artifactId>mapper</artifactId>
                <version>${mapper.version}</version>
            </dependency>

            <!--拼音转换-->
            <dependency>
                <groupId>com.belerweb</groupId>
                <artifactId>pinyin4j</artifactId>
                <version>${pinyin4j.version}</version>
            </dependency>

            <dependency>
                <groupId>com.thoughtworks.xstream</groupId>
                <artifactId>xstream</artifactId>
                <version>${xstream.version}</version>
            </dependency>

            <!--jstl相关-->
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
                <version>${jstl.version}</version>
            </dependency>

            <dependency>
                <groupId>taglibs</groupId>
                <artifactId>standard</artifactId>
                <version>${standard.version}</version>
            </dependency>

            <!--freemarker-->
            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>${freemarker.version}</version>
            </dependency>

            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>jcl-over-slf4j</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
<!--             <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency> -->
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
<!--             <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>${log4j.version}</version>
            </dependency> -->

            <dependency>
                <groupId>dom4j</groupId>
                <artifactId>dom4j</artifactId>
                <version>${dom4j.version}</version>
            </dependency>

            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>jdk.tools</groupId>
                <artifactId>jdk.tools</artifactId>
                <version>${jdk.tools.version}</version>
                <scope>system</scope>
                <systemPath>${env.JAVA_HOME}/lib/tools.jar</systemPath>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
        </dependency>
<!--         <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
 -->        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
        </dependency>

<!--         <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency> -->

        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>


        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
        </dependency>
    </dependencies>

    <!--添加插件-->
    <build>
        <!--管理插件-->
        <!-- <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>${maven-clean-plugin-version}</version>
                </plugin>

                编译插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin-version}</version>
                    <configuration>
                        <source>${java-source-version}</source>
                        <target>${java-target-version}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>

                发布插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin-version}</version>
                </plugin>

                jar包对应的plugin
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <configuration>
                        <archive>
                            <addMavenDescriptor>true</addMavenDescriptor>
                            <index>true</index>
                            <manifest>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            </manifest>
                        </archive>
                    </configuration>
                </plugin>

                打war包对应的插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>${maven-war-plugin-version}</version>
                </plugin>

                安装插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>${maven-install-plugin-version}</version>
                </plugin>

                单元测试插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven-surefire-plugin-version}</version>
                    配置单元测试的时候将单元测试的去掉
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>

                源码插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>${maven-source-plugin-version}</version>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                帮助插件
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-help-plugin</artifactId>
                    <version>${maven-help-plugin-version}</version>
                </plugin>

                在Eclipse下开发的时候用到
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-eclipse-plugin</artifactId>
                    <version>${maven-eclipse-plugin-version}</version>
                    <configuration>
                        <wtpmanifest>true</wtpmanifest>
                        <wtpapplicationxml>true</wtpapplicationxml>
                        <wtpversion>2.0</wtpversion>
                        <downloadSources>true</downloadSources>
                        <downloadJavadocs>true</downloadJavadocs>
                    </configuration>
                </plugin>

                resource插件, 设定编码
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin-version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement> -->
        <!--    <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-help-plugin</artifactId>
               </plugin>
           </plugins> -->
    </build>

</project>
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部