在我们的项目中,我们使用maven从多个镜像下载工件。
当我提供maven构建时,maven只从第一个镜像下载工件。如果第一个镜像中缺少任何工件,则从第二个镜像下载并且构建失败。请找到下面的settings.xml文件。
的settings.xml:
<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">
<localRepository>c:\.m2</localRepository>
<pluginGroups>
<pluginGroup>com.your.plugins</pluginGroup>
-->
<pluginGroup>com.maven.plugins</pluginGroup>
</pluginGroups>
<proxies />
<servers>
<server>
<id>rix-site</id>
<username>admin</username>
<password>admin</password>
</server>
<server>
<id>nexus</id>
<username>gatho7</username>
<password>gatho7</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin</password>
</server>
<server>
<id>releases</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
<mirrors>
<mirror>
<id>itf-central-nexus</id>
<mirrorOf>*</mirrorOf>
<name>ITF central repo</name>
<url>http://ikolplm.greak.com:8081/nexus/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus-rix</id>
<mirrorOf>*</mirrorOf>
<name>Ebcdev mirror</name>
<url>http://kjuiopl-bw00098:8081/content/groups/public</url>
</mirror>
</mirrors>
<profiles>
<!-- EBCManager WAS8 -->
<profile>
<id>ebcmanager</id>
<properties>
<ebcmanager.url>http://XXXXXX.XXXXX/EBCManager</ebcmanager.url>
<ebcmanager.username>username</ebcmanager.username>
<ebcmanager.password>pasword</ebcmanager.password>
<ebcmanager.node>mme.iop.com</ebcmanager.node>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<release.deployment.repository>http://kjuiopl-bw00098:8081/nexus/content/repositories/releases/</release.deployment.repository>
<snapshot.deployment.repository>http://kjuiopl-bw00098:8081/nexus/content/repositories/snapshots/</snapshot.deployment.repository>
<nexus.repository>http://kjuiopl-bw00098:8081/nexus/content/groups/public/</nexus.repository>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mfs.scm.url>http://kjuiopl-bw00098:8081</mfs.scm.url>
<rsm.skip>false</rsm.skip>
</properties>
</profile>
<profile>
<id>rix-nexus</id>
<repositories>
<repository>
<id>rix-nexus</id>
<url>http://kjuiopl-bw00098:8081</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>rix-nexus</activeProfile>
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
的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>com.range.domain</groupId>
<artifactId>pos-obc-parent</artifactId>
<name>pos-obc-parent</name>
<version>1.41.0-SNAPSHOT</version>
<packaging>pom</packaging>
<parent>
<groupId>com.ieak.obcdevelopmentkit</groupId>
<artifactId>parent-obc</artifactId>
<version>7.0.0</version>
</parent>
<properties>
<!-- pos core libraries version-->
<pos.core.version>1.41.0-SNAPSHOT</pos.core.version>
<!-- pos obc core modules version -->
<pos.core.obc.version>1.41.0-SNAPSHOT</pos.core.obc.version>
<eclipse.workspace>C:\\workspace\\pos_eclipse\\pos-develop</eclipse.workspace>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<clearcase.integration.skip>true</clearcase.integration.skip>
<wobclassifier>classes</wobclassifier>
<!-- Test versions -->
<spring-test-dbunit.version>1.0.1</spring-test-dbunit.version>
</properties>
<distributionManagement>
<repository>
<uniqueVersion>true</uniqueVersion>
<id>releases</id>
<name>pos Releases</name>
<url>http://kjuiopl-bw00098:8081/content/repositories/releases</url>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>snapshots</id>
<name>pos Snapshots</name>
<url>http://kjuiopl-bw00098:8081/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posjavacommon</artifactId>
<version>${pos.core.version}</version>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posjavacommon</artifactId>
<version>${pos.core.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posrangedomainmodel</artifactId>
<version>${pos.core.version}</version>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posrangedomainmodel</artifactId>
<version>${pos.core.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posrangeitemdomainmodel</artifactId>
<version>${pos.core.version}</version>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posrangeitemdomainmodel</artifactId>
<version>${pos.core.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posscpdomainmodel</artifactId>
<version>${pos.core.version}</version>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posscpdomainmodel</artifactId>
<version>${pos.core.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>com.ieak.obcposcommon01</groupId>
<artifactId>obcposcommon01</artifactId>
<version>${pos.core.obc.version}</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>com.ieak.obcposcommon01</groupId>
<artifactId>obcposcommon01</artifactId>
<version>${pos.core.obc.version}</version>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>posrangedomainmodelabstract</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.ieak.obcpospim01</groupId>
<artifactId>obcpospim01</artifactId>
<version>${pos.core.obc.version}</version>
<classifier>classes</classifier>
</dependency>
<dependency>
<groupId>com.ieak.obcposscp01</groupId>
<artifactId>obcposscp01</artifactId>
<version>${pos.core.obc.version}</version>
<classifier>classes</classifier>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>com.github.springtestdbunit</groupId>
<artifactId>spring-test-dbunit</artifactId>
<version>${spring-test-dbunit.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<!-- See https://github.com/sonatype/m2eclipse-wtp/wiki/ How-do-I-add-my-web-project-classes-to-another-project-classpath%3F -->
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<properties>
<wobclassifier />
</properties>
</profile>
<profile>
<id>codequality</id>
<build>
<plugins>
<!-- Attach source code artifact -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.9.1</version>
<!-- Doesn't work when not internet connected -->
<executions>
<execution>
<id>validate</id>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
<configuration>
<configLocation>${basedir}/build-tools/checkstyle/pos-checkstyle.xml</configLocation>
<suppressionsLocation>${basedir}/build-tools/checkstyle/pos-suppressions.xml</suppressionsLocation>
<!-- <headerLocation>${basedir}/build-tools/checkstyle/pos-java-header.txt</headerLocation> -->
<propertiesLocation>${basedir}/build-tools/checkstyle/pos-checkstyle.properties</propertiesLocation>
<propertyExpansion>basedir=${basedir}</propertyExpansion>
<enableRSS>false</enableRSS>
<linkXRef>true</linkXRef>
<enableRulesSummary>false</enableRulesSummary>
<consoleOutput>false</consoleOutput>
<failsOnError>false</failsOnError>
<failOnViolation>false</failOnViolation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<enableRulesSummary>true</enableRulesSummary>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.7.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>pmd</goal>
</goals>
</execution>
</executions>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.5</targetJdk>
<includeTests>true</includeTests>
<propertyExpansion>basedir=${basedir}</propertyExpansion>
<excludes>
<exclude>**/generated/*.java</exclude>
</excludes>
<rulesets>
<ruleset>${basedir}/build-tools/pmd/pos-pmd-ruleset.xml</ruleset>
</rulesets>
<excludeRoots>
<excludeRoot>target/generated-sources/stubs</excludeRoot>
</excludeRoots>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>com.range.domain</groupId>
<artifactId>pos-build-tools</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.github.springtestdbunit</groupId>
<artifactId>spring-test-dbunit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<addGroupIdToProjectName>false</addGroupIdToProjectName>
<useProjectReferences>true</useProjectReferences>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>build-tools</directory>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>resource-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<overWrite>true</overWrite>
<includeGroupIds>com.range.domain</includeGroupIds>
<includeArtifactIds>pos-build-tools</includeArtifactIds>
<includes>**/checkstyle/**,**/pmd/**</includes>
<outputDirectory>${project.basedir}/build-tools</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<!-- Eclipse configurations -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<inherited>true</inherited>
<version>2.9</version>
<configuration>
<useProjectReferences>true</useProjectReferences>
<downloadSources>true</downloadSources>
<addGroupIdToProjectName>false</addGroupIdToProjectName>
<workspace>${eclipse.workspace}</workspace>
<workspaceCodeStylesURL>file:///${basedir}/build-tools/checkstyle/pos-formatter.xml</workspaceCodeStylesURL>
<sourceIncludes>
<sourceInclude>**/*.xls</sourceInclude>
<sourceInclude>**/*.xml</sourceInclude>
<sourceInclude>**/*.jpg</sourceInclude>
<sourceInclude>**/*.gif</sourceInclude>
<sourceInclude>**/*.bmp</sourceInclude>
<sourceInclude>**/*.txt</sourceInclude>
<sourceInclude>**/*.properties</sourceInclude>
<sourceInclude>**/*.bin</sourceInclude>
<sourceInclude>**/*.vm</sourceInclude>
<sourceInclude>*</sourceInclude>
</sourceIncludes>
<additionalBuildcommands>
<buildcommand>net.sf.eclipsecs.core.CheckstyleBuilder</buildcommand>
<buildcommand>net.sourceforge.pmd.eclipse.plugin.pmdBuilder</buildcommand>
</additionalBuildcommands>
<additionalProjectnatures>
<projectnature>net.sf.eclipsecs.core.CheckstyleNature</projectnature>
<projectnature>net.sourceforge.pmd.eclipse.plugin.pmdNature</projectnature>
<projectnature>net.sourceforge.pmd.runtime.pmdNature</projectnature>
</additionalProjectnatures>
<additionalConfig>
<file>
<name>.checkstyle</name>
<location>${basedir}/build-tools/checkstyle/eclipse-checkstyle.xml</location>
</file>
<file>
<name>.ruleset</name>
<location>${basedir}/build-tools/pmd/pos-pmd-ruleset.xml</location>
</file>
<file>
<name>.pmd</name>
<location>${basedir}/build-tools/pmd/eclipse-pmd.xml</location>
</file>
<file>
<name>.settings/org.eclipse.core.resources.prefs</name>
<content><![CDATA[eclipse.preferences.version=1${line.separator}encoding/<project>=${project.build.sourceEncoding}${line.separator}]]></content>
</file>
</additionalConfig>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<!-- The java framework version will be the same as the pos-obc-parent's parent since
that is how the dependency to the framework is specified. -->
<JavaFramework-Version>${project.parent.parent.version}</JavaFramework-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>