无法使用windows cmd下载带有maven的jar

时间:2014-11-25 12:33:33

标签: eclipse maven cmd

当我跑步时:

mvn eclipse:eclipse -Dwtpversion=2.0 
Windows cmd中的

我收到以下错误:

D:\workspacespring1\NumberGenerator>mvn eclipse:eclipse -Dwtpversion=2.0
INFO] Scanning for projects...
Downloading: http://192.168.0.172:9090/nexus/content/groups/public/org/codehaus/
mojo/maven-metadata.xml
Downloading: http://192.168.0.172:9090/nexus/content/groups/public/org/apache/ma
ven/plugins/maven-metadata.xml
Downloaded: http://192.168.0.172:9090/nexus/content/groups/public/org/codehaus/m
ojo/maven-metadata.xml (20 KB at 136.7 KB/sec)
Downloaded: http://192.168.0.172:9090/nexus/content/groups/public/org/apache/mav
en/plugins/maven-metadata.xml (13 KB at 87.3 KB/sec)
Downloading: http://192.168.0.172:9090/nexus/content/groups/public/org/apache/ma
ven/plugins/maven-eclipse-plugin/maven-metadata.xml
Downloaded: http://192.168.0.172:9090/nexus/content/groups/public/org/apache/mav
en/plugins/maven-eclipse-plugin/maven-metadata.xml (709 B at 5.5 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building NumberGenerator 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-eclipse-plugin:2.9:eclipse (default-cli) > generate-resources @
NumberGenerator >>>
[INFO]
[INFO] <<< maven-eclipse-plugin:2.9:eclipse (default-cli) < generate-resources @
NumberGenerator <<<
[INFO]
[INFO] --- maven-eclipse-plugin:2.9:eclipse (default-cli) @ NumberGenerator ---
[INFO] Adding support for WTP version 2.0.
[INFO] Using Eclipse Workspace: D:\workspacespring1
[WARNING] Workspace defines a VM that does not contain a valid jre/lib/rt.jar: C
:\Program Files (x86)\Java\jre8
[INFO] no substring wtp server match.
[INFO] Using as WTP server : Apache Tomcat v7.0
[INFO] Adding default classpath container: org.eclipse.jdt.launching.JRE_CONTAIN
ER
Downloading: http://192.168.0.172:9090/nexus/content/groups/public/commons-codec
/commons-codec/1.4/commons-codec-1.4.jar
[WARNING] An error occurred during dependency resolution.
Failed to retrieve commons-codec:commons-codec-1.4
Caused by: Could not find artifact commons-codec:commons-codec:jar:1.4 in nexus
(http://192.168.0.172:9090/nexus/content/groups/public/)

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=commons-codec -DartifactId=commons-codec
-Dversion=1.4 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=commons-codec -DartifactId=commons-codec -D
version=1.4 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]


Path to dependency:
    1) NumberGenerator:NumberGenerator:war:0.0.1-SNAPSHOT
    2) org.apache.httpcomponents:httpclient:jar:4.1.1
    3) commons-codec:commons-codec:jar:1.4


commons-codec:commons-codec:jar:1.4

from the specified remote repositories:
nexus (http://192.168.0.172:9090/nexus/content/groups/public/, releases=true,
snapshots=true)

[INFO] Unable to read jar manifest from C:\Users\n.akbari\.m2\repository\commons
-codec\commons-codec\1.4\commons-codec-1.4.jar
[INFO] File D:\workspacespring1\NumberGenerator\.project already exists.
   Additional settings will be preserved, run mvn eclipse:clean if you want
old settings to be removed.
[INFO] Wrote Eclipse project for "NumberGenerator" to D:\workspacespring1\Number
Generator.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.469 s
[INFO] Finished at: 2014-11-25T15:49:24+03:30
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------

和我的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/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>NumberGenerator</groupId>
<artifactId>NumberGenerator</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>NumberGenerator</name>
<url>http://maven.apache.org</url>

<!-- Shared version number properties -->
<properties>
    <!-- <spring.version>3.0.6.RELEASE</spring.version> <slf4j.version>1.5.6</slf4j.version> -->
    <displaytag.version>1.2</displaytag.version>
</properties>

<build>
    <finalName>NumberGenerator</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.1.Final</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <version>4.3.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.2.1.Final</version>
    </dependency>
    <!-- <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> 
        <version>5.1.25</version> </dependency> -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.3.2.RELEASE</version>
        <exclusions>
            <exclusion>
                <artifactId>spring-asm</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
        </exclusions>
    </dependency>


    <!-- Java EE dependencies -->

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Spring Security -->
    <!-- <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> 
        <version>3.1.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> 
        <artifactId>spring-security-web</artifactId> <version>3.1.3.RELEASE</version> 
        </dependency> <dependency> <groupId>org.springframework.security</groupId> 
        <artifactId>spring-security-config</artifactId> <version>3.1.3.RELEASE</version> 
        </dependency> <dependency> <groupId>org.springframework.security</groupId> 
        <artifactId>spring-security-taglibs</artifactId> <version>3.1.3.RELEASE</version> 
        </dependency> -->

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>3.2.2.RELEASE</version>
    </dependency>

    <!-- json -->

    <!-- <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> 
        <version>1.1.2</version> <scope>runtime</scope> </dependency> -->
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.5.3</version>
    </dependency>

    <!-- dependency to display tag which is used for tabular data display -->
    <!-- <dependency> <groupId>displaytag</groupId> <artifactId>displaytag</artifactId> 
        <version>${displaytag.version}</version> </dependency> -->


    <!-- <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-io</artifactId> 
        <version>1.3.2</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> 
        <artifactId>commons-fileupload</artifactId> <version>1.2.1</version> </dependency> 
        <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> 
        <version>20030825.184428</version> </dependency> <dependency> <groupId>commons-pool</groupId> 
        <artifactId>commons-pool</artifactId> <version>20030825.183949</version> 
        </dependency> -->
    <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> 
        <version>${slf4j.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> 
        <artifactId>slf4j-log4j12</artifactId> <version>1.5.6</version> </dependency> -->
    <!-- junit dependencies -->
    <!-- <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> 
        <scope>test</scope> <version>4.11</version> </dependency> easymock dependencies 
        <dependency> <groupId>org.easymock</groupId> <artifactId>easymock</artifactId> 
        <scope>test</scope> <version>3.1</version> </dependency> <dependency> <groupId>org.mockito</groupId> 
        <artifactId>mockito-all</artifactId> <version>1.8.4</version> <scope>test</scope> 
        </dependency> <dependency> <groupId>hsqldb</groupId> <artifactId>hsqldb</artifactId> 
        <version>1.8.0.10</version> <type>jar</type> <scope>test</scope> </dependency> -->

    <!-- junit dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
        <version>4.11</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpclient</artifactId>
        <version>4.1.1</version>
    </dependency>

    <dependency>
        <groupId>org.apache.httpcomponents</groupId>
        <artifactId>httpcore</artifactId>
        <version>4.3.2</version>
    </dependency>

</dependencies>

<distributionManagement>
    <repository>
        <id>releases</id>
        <name>Nexus Staging Repo</name>
        <url>http://192.168.0.172:9090/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <uniqueVersion>false</uniqueVersion>
        <id>snapshots</id>
        <name>nexus-snapshot</name>
        <url>http://192.168.0.172:9090/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>

</distributionManagement>

<!-- <scm> <url>scm:svn:svn://192.168.0.18/java/coreBanking/jarSource/coreUac</url> 
    </scm> -->

有人可以帮我这个吗?我支持代理,我的同事使用相同的pom.xml文件,他们没有任何问题。

1 个答案:

答案 0 :(得分:0)

如果你注意这一行命令行日志

Downloading: http://192.168.0.172:9090/nexus/content/groups/public/commons-codec
/commons-codec/1.4/commons-codec-1.4.jar
[WARNING] An error occurred during dependency resolution.
Failed to retrieve commons-codec:commons-codec-1.4
Caused by: Could not find artifact commons-codec:commons-codec:jar:1.4 in nexus
(http://192.168.0.172:9090/nexus/content/groups/public/)

你可以看到你试图从192.168.0.172下载一些神器,这是一个本地网络ip,也许你的公司nexus(maven代理服务器)无法访问互联网。

尝试直接从maven公共存储库下载清理settings.xml文件