我在Maven项目上执行全新安装时遇到问题。这是一个旧的Web项目,我使用Eclipse Kepler的“转换为Maven项目”功能转换为Maven。我正在使用JDK 1.6,项目和工作区合规性也设置为1.6。将项目转换为Maven后,我开始配置pom。这大部分都很好。
不幸的是,一旦我部署到本地Tomcat 3.0.36服务器,在运行时,我发现更多错误表明丢失了Jars;这是预期的,失踪的两个被添加到pom。一旦将这两个罐子添加到pom中,我就无法构建,因为Maven说它不能将依赖项从Maven的中央存储库传输到我的本地存储库,因为它是未经授权的。
我的配置中没有设置代理,我几乎肯定我不需要设置代理,特别是因为我可以检索其他依赖项及其元数据,而不是这两个Jars。我确实在我的Maven设置中配置了一个镜像,就像备份中心过载一样。
有谁知道这里发生了什么?是否与错误日志中的“shibboleth”URL有关?我是否需要排除所有wallart依赖项并手动将它们添加到POM中?
错误日志:
[DEBUG] Using mirror Central (http://repo1.maven.org/maven2) for central (http://repo.maven.apache.org/maven2).
[DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=3, ConflictMarker.markTime=1, ConflictMarker.nodeCount=445, ConflictIdSorter.graphTime=2, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=87, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=34, ConflictResolver.conflictItemCount=180, DefaultDependencyCollector.collectTime=9571, DefaultDependencyCollector.transformTime=42}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.129s
[INFO] Finished at: Thu Oct 31 15:48:18 EDT 2013
[INFO] Final Memory: 7M/120M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project <project>: Could not resolve dependencies for project com.<company>:<project>:war:0.0.1: Failed to collect dependencies at org.opensaml:opensaml:jar:2.2.1 -> org.opensaml:openws:jar:1.2.0 -> org.opensaml:xmltooling:jar:1.1.0 -> org.bouncycastle:bcprov-ext-jdk15:jar:1.40: Failed to read artifact descriptor for org.bouncycastle:bcprov-ext-jdk15:jar:1.40: Could not transfer artifact org.bouncycastle:bcprov-ext-jdk15:pom:1.40 from/to Central (http://repo1.maven.org/maven2): Not authorized , ReasonPhrase:Unauthorized. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project <project>: Could not resolve dependencies for project com.<company>:<project>:war:0.0.1: Failed to collect dependencies at org.opensaml:opensaml:jar:2.2.1 -> org.opensaml:openws:jar:1.2.0 -> org.opensaml:xmltooling:jar:1.1.0 -> org.bouncycastle:bcprov-ext-jdk15:jar:1.40
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:220)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.<company>:<project>:war:0.0.1: Failed to collect dependencies at org.opensaml:opensaml:jar:2.2.1 -> org.opensaml:openws:jar:1.2.0 -> org.opensaml:xmltooling:jar:1.1.0 -> org.bouncycastle:bcprov-ext-jdk15:jar:1.40
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:167)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 23 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at org.opensaml:opensaml:jar:2.2.1 -> org.opensaml:openws:jar:1.2.0 -> org.opensaml:xmltooling:jar:1.1.0 -> org.bouncycastle:bcprov-ext-jdk15:jar:1.40
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:292)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:317)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:159)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.bouncycastle:bcprov-ext-jdk15:jar:1.40
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:335)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:461)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:573)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:573)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:573)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:261)
... 26 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.bouncycastle:bcprov-ext-jdk15:pom:1.40 from/to Central (http://repo1.maven.org/maven2): Not authorized , ReasonPhrase:Unauthorized.
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:320)
... 32 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.bouncycastle:bcprov-ext-jdk15:pom:1.40 from/to Central (http://repo1.maven.org/maven2): Not authorized , ReasonPhrase:Unauthorized.
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1016)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1004)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized , ReasonPhrase:Unauthorized.
at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:932)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:660)
... 4 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
这是我的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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>project</artifactId>
<version>0.0.1</version>
<packaging>war</packaging>
<name>Web Services</name>
<description>This project handles communication.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>opensaml</id>
<name>OpenSAML Repository</name>
<url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<!-- This plugin installs the Evip jar from the project's lib to the local
repository for normal Maven consumption -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<inherited>false</inherited>
<executions>
<execution>
<id>install-evip-jar</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>mvn</executable>
<arguments>
<argument>install:install-file</argument>
<argument>-Dfile=${basedir}\WebContent\WEB-INF\lib\EVIPSoapServer.jar</argument>
<argument>-DgroupId=com.convergys</argument>
<argument>-DartifactId=EVIPSoapServer</argument>
<argument>-Dversion=1.0.0</argument>
<argument>-Dpackaging=jar</argument>
</arguments>
</configuration>
</plugin>
<!-- This will compile source files into class files -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- This includes java source files in the same location as class files -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<webResources>
<resource>
<directory>${project.build.sourceDirectory}</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--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.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
exec-maven-plugin
</artifactId>
<versionRange>
[1.2.1,)
</versionRange>
<goals>
<goal>exec</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- COMPILE DEPENDENCIES -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.convergys</groupId>
<artifactId>EVIPSoapServer</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-jaxws</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
<version>1.5.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.5.4</version>
<scope>compile</scope>
<exclusions>
<!-- CANNOT HAVE SERVLET-API IN WEB-INF/LIB FOLDER -->
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-trust</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>openws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-core</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
</exclusion>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>openws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>axiom-api</artifactId>
<version>1.2.10</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>opensaml</artifactId>
<version>2.2.1</version>
<exclusions>
<exclusion>
<groupId>opensaml</groupId>
<artifactId>openws</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>opensaml</groupId>
<artifactId>openws</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.opensaml</groupId>
<artifactId>xmltooling</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15</artifactId>
<version>1.43</version>
</dependency>
<!-- PROVIDED DEPENDENCIES -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
答案 0 :(得分:1)
垒垒罐子都将xalan声明为传递依赖。从错误消息:
Failed to collect dependencies at org.apache.rampart:rampart-trust:jar:1.5.1 -> org.apache.rampart:rampart-policy:jar:1.5.1 -> org.apache.xalan:xalan:jar:2.7.1
提到的最后一个罐子是Maven找不到的。
由于某种原因,xalan
工件在组ID org.apache.xalan
下无法使用(可能是在某个时候?)。但它在组xalan
下可用。因此,快速解决方法是将其从每个wallart依赖项中排除,并使用xalan
组ID自行声明。
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-trust</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rampart</groupId>
<artifactId>rampart-core</artifactId>
<version>1.5.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.xalan</groupId>
<artifactId>xalan</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.1</version>
</dependency>
答案 1 :(得分:0)
2012年,shibboleth迁移了他的存储库的位置 http://shibboleth.internet2.edu/downloads/maven2/到https://build.shibboleth.net/nexus/content/repositories/releases/。 然而,像opensaml这样的公认库的一些pom文件引用了相同的旧位置。 错误记录在this link中,其中有一些重点:
如果在此位置查找某个工件,它将返回包含信息性消息的网页。如果maven试图找到一个罐子怎么办?你将在你的本地仓库中获得一个html文件,但是带有所查看jar的名称。正确的行为是服务器返回不同于200的html状态。
你会尝试创建一个本地库存储库(使用nexus,artifactory等...),但是第一次需要加载库....
目前我需要编译一个具有axis2 1.6.0依赖关系的旧项目,该项目使用Web服务的一些安全功能,我需要编译公司存储库的旧项目,我需要找到一个解决方案。 解决方案的实施情况如下所示:
在etc / hosts文件中添加最后一个位置的映射:
'# redirect to a non existent url to discard artifacts of this repository: 127.0.0.127 shibboleth.internet2.edu
在〜/ .m2 /目录中添加一个settings.xml文件,其中包含新的包含jar的存储库,例如,wso2存储库:
...
<repository>
<id>wso2-repository.central</id>
<name>Wso2 Maven</name>
<url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.central</id>
<name>Central Repository for Maven</name>
<url>http://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven-repository.dev.java.net</id>
<name>Java.net Repository for Maven 1</name>
<url>http://download.java.net/maven/1/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven 2</name>
<url>http://download.java.net/maven/2/</url>
</repository>
<repository>
<id>build.shibboleth.net</id>
<name>Shibboleth.New</name>
<url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
<layout>default</layout>
</repository>
...
我已经尝试过其他解决方案,例如排除发布和快照声明,或者为存储库执行不存在的miror,但没有运气问题
<!--
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>shibboleth.internet2.edu</id>
<name>Shibboleth.Old</name>
<url>http://shibboleth.internet2.edu/downloads/maven2/</url>
<layout>default</layout>
</repository>
-->
<!-- #region: disable shibboleth -->
<!--
<mirror>
<id>shibboleth-release-disable</id>
<name>DisbleShibboleth</name>
<url>http://0.0.0.0/null</url>
<mirrorOf>shibboleth-release</mirrorOf>
</mirror>
-->
可以自由尝试如果它可以帮到你。