nexus-3.6.0-02-unix.tar.gz安裝(Centos下),maven setting.xml配置案例,專案root的pom.xml配置,parent-pom的pom.xml配置案例
阿新 • • 發佈:2019-02-07
1、下載nexus
2、Centos下安裝Nexus
安裝JDK,此處略,檢查自己虛擬機器上的JDK版本如下:
使用xftp將nexus上傳到:/home/tuzq/software
首先解壓下載到的檔案:
[[email protected] software]# tar -zxvf nexus-3.6.0-02-unix.tar.gz
[[email protected] 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
[[email protected] init.d]# service nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
Starting nexus
[[email protected] 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
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}