Eclipse Maven Nexus

 

Nexus:
nexus\bin\jsw\windows-x86-64\install-nexus   #install it to Wndows Service.

目前较快的maven镜像:

http://mirrors.ibiblio.org/maven2/  #中有.index目录:nexus-maven-repository-index.gz nexus-maven-repository-index.properties

http://uk.maven.org/maven2/
http://repository.jboss.org/nexus/content/groups/public/

快速的获取nexus-maven-repository-index.gz和nexus-maven-repository-index.properties的方法:先下载这2个文件,再copy到Tomcat ROOT 构建maven2/.index目录(win下尝试在cmd下mkdir),并修改到80端口。

 

#ref--> http://blog.163.com/benbenfafa_88/blog/static/6493016220130451915187/

1.在Maven setting.xml文件中配置Nexus仓库,profile mirror  ?
本地仓库 >profile > pom中的repository > mirror 但是如果<mirrorOf>*</mirrorOf>,maven会忽略掉其他设置的各种类型仓库,只在mirror里面找。
中央仓库(central,Central Repository), 中央仓库是maven核心自带的远程仓库,默认url在 MAVEN_HOME/lib/maven-model-builder-3.X.jar,
org/apache/maven/model/pom-4.0.0.xml  -->
<repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories>
  <build>
    <directory>${project.basedir}/target</directory>
    。。。。。。

e.g:【<dependency>
    <groupId>xxx</groupId>
    <artifactId>xxx</artifactId>
    <version>1.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/lib/xxx.jar</systemPath>
</dependency>】
在setting.xml中:
<mirror> 
        <id>nexus</id> 
        <name>Nexus Public Mirror</name> 
        <url>http://localhost:8081/nexus/content/groups/public</url> 
        <mirrorOf>central</mirrorOf><!--override the default central repository[https://repo.maven.apache.org/maven2]-->
    </mirror>

project's pom.xml中的repositories只是补充central repository而非替代!

 

2.Hosted upload ?   部署构件到Nexus仓库?

 <distributionManagement>
    <repository>
        <id>releases</id>
        <name>Releases</name>
        <url>http://192.168.0.21:8081/nexus/content/repositories/releases</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>Snapshots</name>
        <url>http://192.168.0.21:8081/nexus/content/repositories/snapshots</url>
    </snapshotRepository>
</distributionManagement>

Maven:

 M2_HOME

 

 

 

 update project--->.lastUpdated
 针对私服与中央仓库或第三方仓库之间网络传输问题
 Browser Storage--->找到相应的package 先update index,再expire cache

 

Eclipse:

 Maven Preferences-->installations: MAVEN_HOME , User Settings: MAVEN_HOME
pom.xml -->JDK VERSION CFG :
<build>
    <finalName>project name</finalName>
    <plugins> 
      <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <configuration> 
          <source>1.7</source> 
          <target>1.7</target> 
        </configuration> 
      </plugin> 
    </plugins>
  </build>

 

 

 

 

 

你可能感兴趣的:(maven nexus)