当maven尝试解决依赖关系时出错

时间:2015-07-06 09:24:03

标签: java maven

这是我的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--

    This file is part of JEMMA - http://jemma.energy-home.org
    (C) Copyright 2013 Telecom Italia (http://www.telecomitalia.it)

    JEMMA is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License (LGPL) version 3
    or later as published by the Free Software Foundation, which accompanies
    this distribution and is available at http://www.gnu.org/licenses/lgpl.html

    JEMMA is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License (LGPL) for more details.


-->
<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>org.energy-home</groupId>
    <artifactId>jemma.osgi.utils</artifactId>
    <packaging>bundle</packaging>
    <version>1.0.6</version>
    <name>Osgi Utils</name>
    <properties>
        <felix.bundle.plugin.version>2.5.3</felix.bundle.plugin.version>
        <org.eclipse.osgi.version>3.10.0</org.eclipse.osgi.version>
        <org.eclipse.osgi.services.version>3.4.0</org.eclipse.osgi.services.version>
        <org.apache.commons.codec.version>1.3.0</org.apache.commons.codec.version>
        <stax-osgi.version>0.3.95</stax-osgi.version>
        <javax.activation.version>1.1</javax.activation.version>
        <org.apache.httpcomponents.httpclient>4.1.0</org.apache.httpcomponents.httpclient>
        <org.apache.httpcomponents.httpcore>4.1.0</org.apache.httpcomponents.httpcore>
        <com.googlecode.jaxb-namespaceprefixmapper-interfaces>2.2.4</com.googlecode.jaxb-namespaceprefixmapper-interfaces>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${felix.bundle.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <supportedProjectTypes>
                        <supportedProjectType>jar</supportedProjectType>
                        <supportedProjectType>bundle</supportedProjectType>
                        <supportedProjectType>war</supportedProjectType>
                    </supportedProjectTypes>
                    <manifestLocation>META-INF</manifestLocation>
                    <instructions>
                        <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                        <Bundle-Name>${project.name}</Bundle-Name>
                        <Bundle-Version>${project.version}</Bundle-Version>
                        <Import-Package>javax.xml.bind,
                             javax.xml.bind.annotation,
                             javax.xml.bind.annotation.adapters,
                             javax.xml.bind.helpers,
                             javax.xml.namespace,
                             javax.crypto,
                             javax.crypto.spec,
                             org.apache.commons.codec,
                             org.slf4j;version="[1.6,2)",
                             org.eclipse.osgi.framework.console;version="1.0.0",
                             org.osgi.framework;version="1.3.0",*;resolution:=optional
                        </Import-Package>
                        <Export-Package>org.energy_home.jemma.osgi.utils.equinox.console;version="1.0.0",
                             org.energy_home.jemma.utils.datetime;version="1.0.1",
                             org.energy_home.jemma.utils.encrypt;version="1.0.0",
                             org.energy_home.jemma.utils.rest;version="1.0.0",
                             org.energy_home.jemma.utils.thread;version="1.0.0",
                             org.energy_home.jemma.utils.xml.jaxb;version="1.0.0"
                        </Export-Package>
                        <Require-Bundle>org.apache.httpcomponents.httpclient;bundle-version="4.1.0",
                             org.apache.httpcomponents.httpcore;bundle-version="4.1.0"
                        </Require-Bundle>
                        <Bundle-Vendor>Telecom Italia</Bundle-Vendor>
                        <Bundle-Category>Automation@Home</Bundle-Category>
                        <Bundle-Activator>org.energy_home.jemma.osgi.utils.Activator</Bundle-Activator>
                        <Bundle-RequiredExecutionEnvironment>JavaSE-1.6</Bundle-RequiredExecutionEnvironment>
                        <Embed-Dependency>JAXBNamespacePrefixMapper,!*</Embed-Dependency>
                        <Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
                    </instructions>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <dependencies>
        <dependency>
            <groupId>org.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi</artifactId>
            <version>${org.eclipse.osgi.version}</version>
            <scope>compile</scope>

        </dependency>

        <dependency>
            <groupId>org.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi.services</artifactId>
            <version>${org.eclipse.osgi.services.version}</version>
            <scope>compile</scope>

        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>org.apache.commons.codec</artifactId>
            <version>${org.apache.commons.codec.version}</version>
            <scope>compile</scope>

        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>org.apache.httpcomponents.httpclient</artifactId>
            <version>${org.apache.httpcomponents.httpclient}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>org.apache.httpcomponents.httpcore</artifactId>
            <version>${org.apache.httpcomponents.httpcore}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
              <groupId>com.sun.enterprise</groupId>
              <artifactId>stax-osgi</artifactId>
              <version>${stax-osgi.version}</version>
              <scope>compile</scope>
        </dependency>
        <dependency>
              <groupId>javax.activation</groupId>
              <artifactId>javax.activation</artifactId>
              <version>${javax.activation.version}</version>
              <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.googlecode.jaxb-namespaceprefixmapper-interfaces</groupId>
            <artifactId>JAXBNamespacePrefixMapper</artifactId>
            <version>${com.googlecode.jaxb-namespaceprefixmapper-interfaces}</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

这是我运行mvn clean install

时的日志
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Osgi Utils 1.0.6
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 is missing, no dependency information available
[WARNING] The POM for org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 is missing, no dependency information available
[WARNING] The POM for org.apache.commons:org.apache.commons.codec:jar:1.3.0 is missing, no dependency information available
[WARNING] The POM for org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 is missing, no dependency information available
[WARNING] The POM for org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 is missing, no dependency information available
[WARNING] The POM for javax.activation:javax.activation:jar:1.1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.796s
[INFO] Finished at: Mon Jul 06 11:21:06 CEST 2015
[INFO] Final Memory: 8M/102M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project jemma.osgi.utils: Could not resolve dependencies for project org.energy-home:jemma.osgi.utils:bundle:1.0.6: Failed to collect dependencies for [org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 (compile), org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 (compile), org.apache.commons:org.apache.commons.codec:jar:1.3.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 (compile), com.sun.enterprise:stax-osgi:jar:0.3.95 (compile), javax.activation:javax.activation:jar:1.1 (compile), com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper:jar:2.2.4 (compile)]: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.3: Could not transfer artifact woodstox:wstx-asl:pom:3.2.3 from/to jvnet-maven1-repository (http://download.java.net/maven/1/): No connector available to access repository jvnet-maven1-repository (http://download.java.net/maven/1/) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

这是完整的错误堆栈跟踪(运行命令whit -X参数)

[ERROR] Failed to execute goal on project jemma.osgi.utils: Could not resolve dependencies for project org.energy-home:jemma.osgi.utils:bundle:1.0.6: Failed to collect dependencies for [org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 (compile), org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 (compile), org.apache.commons:org.apache.commons.codec:jar:1.3.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 (compile), com.sun.enterprise:stax-osgi:jar:0.3.95 (compile), javax.activation:javax.activation:jar:1.1 (compile), com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper:jar:2.2.4 (compile)]: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.3: Could not transfer artifact woodstox:wstx-asl:pom:3.2.3 from/to jvnet-maven1-repository (http://download.java.net/maven/1/): No connector available to access repository jvnet-maven1-repository (http://download.java.net/maven/1/) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project jemma.osgi.utils: Could not resolve dependencies for project org.energy-home:jemma.osgi.utils:bundle:1.0.6: Failed to collect dependencies for [org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 (compile), org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 (compile), org.apache.commons:org.apache.commons.codec:jar:1.3.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 (compile), com.sun.enterprise:stax-osgi:jar:0.3.95 (compile), javax.activation:javax.activation:jar:1.1 (compile), com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper:jar:2.2.4 (compile)]
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
    at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
    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:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project org.energy-home:jemma.osgi.utils:bundle:1.0.6: Failed to collect dependencies for [org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 (compile), org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 (compile), org.apache.commons:org.apache.commons.codec:jar:1.3.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 (compile), com.sun.enterprise:stax-osgi:jar:0.3.95 (compile), javax.activation:javax.activation:jar:1.1 (compile), com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper:jar:2.2.4 (compile)]
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:158)
    at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
    ... 22 more
Caused by: org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [org.eclipse.osgi:org.eclipse.osgi:jar:3.10.0 (compile), org.eclipse.osgi:org.eclipse.osgi.services:jar:3.4.0 (compile), org.apache.commons:org.apache.commons.codec:jar:1.3.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpclient:jar:4.1.0 (compile), org.apache.httpcomponents:org.apache.httpcomponents.httpcore:jar:4.1.0 (compile), com.sun.enterprise:stax-osgi:jar:0.3.95 (compile), javax.activation:javax.activation:jar:1.1 (compile), com.googlecode.jaxb-namespaceprefixmapper-interfaces:JAXBNamespacePrefixMapper:jar:2.2.4 (compile)]
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308)
    at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150)
    ... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for woodstox:wstx-asl:jar:3.2.3
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:412)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.process(DefaultDependencyCollector.java:544)
    at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:240)
    ... 25 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact woodstox:wstx-asl:pom:3.2.3 from/to jvnet-maven1-repository (http://download.java.net/maven/1/): No connector available to access repository jvnet-maven1-repository (http://download.java.net/maven/1/) of type legacy using the available factories WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:281)
    ... 29 more
Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact woodstox:wstx-asl:pom:3.2.3 from/to jvnet-maven1-repository (http://download.java.net/maven/1/): No connector available to access repository jvnet-maven1-repository (http://download.java.net/maven/1/) of type legacy using the available factories WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:468)
    ... 32 more
Caused by: org.sonatype.aether.transfer.NoRepositoryConnectorException: No connector available to access repository jvnet-maven1-repository (http://download.java.net/maven/1/) of type legacy using the available factories WagonRepositoryConnectorFactory
    at org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.getRepositoryConnector(DefaultRemoteRepositoryManager.java:400)
    at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:453)
    ... 32 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

到目前为止我尝试过:

  • 删除.m2文件夹
  • <type>pom</type>添加到依赖项

每次我都遇到同样的错误

1 个答案:

答案 0 :(得分:1)

问题的快速解决方法是手动下载jar,例如来自maven central

然后手动在本地安装所需的依赖项:

  

mvn install:install-file -Dfile = / home / tomasi / tmp / wstx-asl-3.2.3.jar   -DgroupId = woodstox -DartifactId = wstx-asl -Dversion = 3.2.3 -Dpackaging = jar

它无法明确解决遗留依赖性问题,但至少可以让您继续构建。