我有一个在我的本地计算机上正常构建的项目。在我的公司,我们使用服务器机器进行持续集成,但该机器没有连接到互联网。所以我设置了artifactory并将我的整个存储库复制到它。然后连接jenkins与这个神器。所以jenkins应该没有任何问题吗?因为它与我的本地项目具有相同的设置。
在构建一段消息后,会弹出一条他无法找到依赖关系的消息:
[错误]无法在项目crs-data上执行目标:无法解决 项目的依赖关系com.ing.crs:crs-data:jar:1.1.3-SNAPSHOT: 无法收集依赖项 [com.ing.crs:crs-framework:jar:1.1.3-SNAPSHOT(编译), org.apache.openjpa:openjpa-all:jar:2.3.0(已提供), ibm.websphere:j2ee6:jar:8.5.0(已提供), ibm.websphere:jpaThinClient:jar:8.5.0(已提供), com.google.guava:guava:jar:14.0.1(编译), org.hamcrest:hamcrest-all:jar:1.3(test),junit:junit:jar:4.11(test), mockito-all:mockito-all:jar:1.8.4(test),oracle.jdbc:ojdbc6:jar:11.2 (测试),com.h2数据库:h2:jar:1.3.167(测试), ibm.websphere:embeddedEJBContainer:jar:8.5.0(测试), com.ing.be:bbllib.DeploymentInfo:jar:2.3.2(已提供)]:未能成功 读取commons-dbcp的工件描述符:commons-dbcp:jar:1.4:可以 不传输工件commons-dbcp:commons-dbcp:pom:1.4 from / to crs.maven.repo (http://sdbeapp00433.devbe.development:8082/artifactory/repo):访问权限 否认: http://sdbeapp00433.devbe.development:8082/artifactory/repo/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.pom - > [帮助1]
但是本地构建甚至不使用commons-dbcp:commons-dbcp:pom:1.4。怎么可能????
pom:
<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">
<parent>
<groupId>com.ing.crs</groupId>
<artifactId>crs-parent-pom</artifactId>
<version>1.1.3-SNAPSHOT</version>
<relativePath>../crs-parent-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>crs-data</artifactId>
<version>${project.crs-data.version}</version>
<profiles>
<profile>
<id>default</id>
<properties>
<dbDictionary>disableAlterSeqenceIncrementBy=true</dbDictionary>
</properties>
</profile>
<profile>
<id>stubs</id>
<properties>
<dbDictionary></dbDictionary>
</properties>
</profile>
</profiles>
<dependencies>
<!-- CRS -->
<dependency>
<groupId>com.ing.crs</groupId>
<artifactId>crs-framework</artifactId>
<version>${project.crs-framework.version}</version>
</dependency>
<!-- Other -->
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>j2ee6</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>jpaThinClient</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<!-- test -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>mockito-all</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc6</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.167</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>embeddedEJBContainer</artifactId>
<version>8.5.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ing.be</groupId>
<artifactId>bbllib.DeploymentInfo</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>crs-data</finalName>
<outputDirectory>target/crs-data</outputDirectory>
<plugins>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<compilerArguments>-Aopenjpa.source=7 -Aopenjpa.metamodel=true</compilerArguments>
<processors>
<processor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</processor>
</processors>
<outputDirectory>target/generated-sources/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/metamodel</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<id>enhancer_for_test</id>
<configuration>
<includes>**/entities/**/*.class</includes>
<includes>**/data/**/*.class</includes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>copy-test-persistence</id>
<phase>process-test-resources</phase>
<configuration>
<tasks>
<!--backup the "proper" persistence.xml-->
<copy file="${project.build.outputDirectory}/META-INF/persistence.xml" tofile="${project.build.outputDirectory}/META-INF/persistence.xml.proper"/>
<!--replace the "proper" persistence.xml with the "test" version-->
<!-- copy file="${project.build.testOutputDirectory}/META-INF/persistence.xml" tofile="${project.build.outputDirectory}/META-INF/persistence.xml"/-->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>restore-persistence</id>
<phase>prepare-package</phase>
<configuration>
<tasks>
<!--restore the "proper" persistence.xml-->
<copy file="${project.build.outputDirectory}/META-INF/persistence.xml.proper" tofile="${project.build.outputDirectory}/META-INF/persistence.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathLayoutType>custom</classpathLayoutType>
<customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>
</manifest>
<manifestEntries>
<Implementation-Version>${project.version}</Implementation-Version>
<Build-Time>${timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.1.1</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
openjpa-maven-plugin
</artifactId>
<versionRange>
[1.0,)
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>false</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.openjpa
</groupId>
<artifactId>
openjpa-maven-plugin
</artifactId>
<versionRange>
[2.2.1,)
</versionRange>
<goals>
<goal>enhance</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
答案 0 :(得分:1)
您的构建失败,因为由于身份验证问题,Maven无法从Artifactory下载依赖项:
Access denied to: http://sdbeapp00433.devbe.development:8082/artifactory/repo/commons-dbcp/commons-dbcp/1.4/commons-dbcp-1.4.pom
如果您要查看Artifactory access.log,您应该会看到有关拒绝下载的匹配日志条目。
如果您正在使用Artifactory Jenkins插件,则可以按照here所述配置解析程序凭据。
如果您没有使用Artifactory Jenkins插件,则应按"Working With Maven"中所述配置Maven身份验证。这需要将正确的凭据添加到Maven settings.xml文件中
第三种选择是允许匿名访问Artifactory,如here所述。这样就可以在不进行身份验证的情况下解决Artifactory的依赖关系。
commons-dbcp可能是一个传递依赖。如果要查找其来源,则应使用Maven依赖项插件的dependency:tree目标,该插件显示此项目的依赖关系树。
作为旁注,你不应该使用&#34; repo&#34;库。这是一个默认的全局虚拟存储库,可以有效地聚合所有其他存储库。通过使用此URL配置Maven,对工件的任何请求都将通过Artifactory,它将搜索系统中定义的所有本地和远程存储库。最好使用虚拟存储库,该虚拟存储库仅聚合构建的相关存储库。