Java Maven构建错误-拒绝连接到Maven中央存储库,即使我不在代理网络中
当我创建了新的maven项目,清理并构建它时,我收到了这个错误消息Java Maven构建错误-拒绝连接到Maven中央存储库,即使我不在代理网络中,java,maven,Java,Maven,当我创建了新的maven项目,清理并构建它时,我收到了这个错误消息 Scanning for projects... ------------------------------------------------------------------------ Building mavenproject6 1.0-SNAPSHOT ------------------------------------------------------------------------ Download
Scanning for projects...
------------------------------------------------------------------------
Building mavenproject6 1.0-SNAPSHOT
------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.pom
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 22.506s
Finished at: Wed Jan 27 12:26:55 IST 2016
Final Memory: 7M/123M
------------------------------------------------------------------------
Plugin org.apache.maven.plugins:maven-compiler-plugin:2.3.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.3.2 from/to central (http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused: Connection timed out: connect -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
我试图添加maven-resources-plugin-2.5.jar
,maven-resources-plugin-2.5
,maven-surefire-plugin-2.10.jar
和maven-install-plugin-2.3.1.jar
到C:\Users\MI Synergy.m2\repository\org\apache\maven\plugins\maven resources plugin\2.5并通过cmd输入命令mvn compile
但它也不起作用
有一个丢失的POM文件,该文件已经存在
请帮我做这个。几天来我一直在尝试这件事,我尽了我所能
多谢各位
编辑
我的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.exm</groupId>
<artifactId>mavenproject6</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>mavenproject6</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
4.0.0
com.exm
mavenproject6
1.0-快照
战争
mavenproject6
${project.build.directory}/project
UTF-8
爪哇
javaeewebapi
6
假如
org.apache.maven.plugins
maven编译器插件
2.3.2
1.6
1.6
${annowed.dir}
org.apache.maven.plugins
maven战争插件
2.1.1
假的
org.apache.maven.plugins
maven依赖插件
2.1
验证
复制
${annowed.dir}
真的
爪哇
javaee认可的api
6
罐子
我没有面临任何问题,当我进行清洁安装时,我获得了构建成功
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.exm</groupId>
<artifactId>mavenproject6</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>mavenproject6</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
4.0.0
com.exm
您有代理吗?因为如果你有,你必须在你的settings.xml(maven的配置文件)中配置它。不,我没有在netbeans中使用代理,只是使用来自加密狗的数据连接。你能发布你的pom.xml吗?@Pratap a.K我添加了它。你的pom缺少结束标记,这是一个拼写错误吗?但我没有(我不知道问题出在哪里,是从命令提示符还是从IDE?从netbeans开始,我在netbeansAdd central repo1.maven.org/maven2中设置了任何代理,然后再试一次请给出答案,而不是评论。)
<repository>
<id>central</id>
<name>Central</name>
<url>http://repo1.maven.org/maven2</url>
</repository>