2017-08-01 77 views
0

我正在使用Spring工具套件,與embebbed maven,我得到這個問題創建一個新的Maven項目。 我已經嘗試了類似帖子中給出的每個答案;清理存儲庫和重建,settings.xml中的代理,指向正確的xml,使用自己的maven等等,我做錯了什麼? 問題進行全面介紹::無法計算構建計劃:插件org.apache.maven.plugins:maven-resources-plugin:2.6?

Could not calculate build plan: Plugin org.apache.maven.plugins:maven- 
resources-plugin:2.6 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.apache.maven.plugins:maven- 
resources-plugin:jar:2.6 
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its 
dependencies could not be resolved: Failed to read artifact descriptor for 
org.apache.maven.plugins:maven-resources-plugin:jar:2.6 

settins.xml

<proxies>  
<!-- proxy | Specification for one proxy, to be used in connecting to the 
network. | <proxy> <id>optional</id> <active>true</active> 
<protocol>http</protocol> <username>proxyuser</username> 
<password>proxypass</password> <host>proxy.host.net</host> <port>80</port> 
<nonProxyHosts>local.net|some.host.com</nonProxyHosts> </proxy> --> 
<proxy> 
    <id>proxy</id> 
    <active>true</active> 
    <protocol>http</protocol> 
    <host>proxy-ccy.houston.hp.com</host> 
    <port>8080</port> 
</proxy> 
<proxy> 
    <id>proxy1</id> 
    <active>true</active> 
    <protocol>http</protocol> 
    <host>proxy.austin.hp.com</host> 
    <port>8080</port> 
</proxy> 
</proxies> 

的pom.xml

<?xml version="1.0"?> 
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.marco.arale</groupId> 
    <artifactId>maven-arale</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>maven-arale</name> 
    <repositories> 
    <repository> 
     <snapshots> 
     <enabled>false</enabled> 
     </snapshots> 
     <id>central</id> 
     <name>Central Repository</name> 
     <url>https://repo.maven.apache.org/maven2</url> 
    </repository> 
    </repositories> 
    <pluginRepositories> 
    <pluginRepository> 
     <releases> 
     <updatePolicy>never</updatePolicy> 
     </releases> 
     <snapshots> 
     <enabled>false</enabled> 
     </snapshots> 
     <id>central</id> 
     <name>Central Repository</name> 
     <url>https://repo.maven.apache.org/maven2</url> 
    </pluginRepository> 
    </pluginRepositories> 
    <build> 
    <sourceDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\src\main\java</sourceDirectory> 
    <scriptSourceDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\src\main\scripts</scriptSourceDirectory> 
    <testSourceDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\src\test\java</testSourceDirectory> 
    <outputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\classes</outputDirectory> 
    <testOutputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\test-classes</testOutputDirectory> 
    <resources> 
     <resource> 
     <directory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\src\main\resources</directory> 
     </resource> 
    </resources> 
    <testResources> 
     <testResource> 
     <directory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\src\test\resources</directory> 
     </testResource> 
    </testResources> 
    <directory>C:\Users\lopezbae\Documents\stsworkspace\maven- <finalName>maven-arale-0.0.1-SNAPSHOT</finalName> 
    <pluginManagement>arale\target</directory> 
     <plugins> 
     <plugin> 
      <artifactId>maven-antrun-plugin</artifactId> 
      <version>1.3</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-assembly-plugin</artifactId> 
      <version>2.2-beta-5</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-dependency-plugin</artifactId> 
      <version>2.8</version> 
     </plugin> 
     <plugin> 
      <artifactId>maven-release-plugin</artifactId> 
      <version>2.3.2</version> 
     </plugin> 
     </plugins> 
    </pluginManagement> 
    <plugins> 
     <plugin> 
     <artifactId>maven-clean-plugin</artifactId> 
     <version>2.5</version> 
     <executions> 
      <execution> 
      <id>default-clean</id> 
      <phase>clean</phase> 
      <goals> 
       <goal>clean</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-resources-plugin</artifactId> 
     <version>2.6</version> 
     <executions> 
      <execution> 
      <id>default-testResources</id> 
      <phase>process-test-resources</phase> 
      <goals> 
       <goal>testResources</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-resources</id> 
      <phase>process-resources</phase> 
      <goals> 
       <goal>resources</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-jar-plugin</artifactId> 
     <version>2.4</version> 
     <executions> 
      <execution> 
      <id>default-jar</id> 
      <phase>package</phase> 
      <goals> 
       <goal>jar</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.1</version> 
     <executions> 
      <execution> 
      <id>default-compile</id> 
      <phase>compile</phase> 
      <goals> 
       <goal>compile</goal> 
      </goals> 
      </execution> 
      <execution> 
      <id>default-testCompile</id> 
      <phase>test-compile</phase> 
      <goals> 
       <goal>testCompile</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-surefire-plugin</artifactId> 
     <version>2.12.4</version> 
     <executions> 
      <execution> 
      <id>default-test</id> 
      <phase>test</phase> 
      <goals> 
       <goal>test</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-install-plugin</artifactId> 
     <version>2.4</version> 
     <executions> 
      <execution> 
      <id>default-install</id> 
      <phase>install</phase> 
      <goals> 
       <goal>install</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-deploy-plugin</artifactId> 
     <version>2.7</version> 
     <executions> 
      <execution> 
      <id>default-deploy</id> 
      <phase>deploy</phase> 
      <goals> 
       <goal>deploy</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <artifactId>maven-site-plugin</artifactId> 
     <version>3.3</version> 
     <executions> 
      <execution> 
      <id>default-site</id> 
      <phase>site</phase> 
      <goals> 
       <goal>site</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\site</outputDirectory> 
       <reportPlugins> 
       <reportPlugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-project-info-reports-plugin</artifactId> 
       </reportPlugin> 
       </reportPlugins> 
      </configuration> 
      </execution> 
      <execution> 
      <id>default-deploy</id> 
      <phase>site-deploy</phase> 
      <goals> 
       <goal>deploy</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\site</outputDirectory> 
       <reportPlugins> 
       <reportPlugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-project-info-reports-plugin</artifactId> 
       </reportPlugin> 
       </reportPlugins> 
      </configuration> 
      </execution> 
     </executions> 
     <configuration> 
      <outputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\site</outputDirectory> 
      <reportPlugins> 
      <reportPlugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-project-info-reports-plugin</artifactId> 
      </reportPlugin> 
      </reportPlugins> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <reporting> 
    <outputDirectory>C:\Users\lopezbae\Documents\stsworkspace\maven-arale\target\site</outputDirectory> 
    </reporting> 
</project> 
+0

你似乎有互聯網連接的問題,或者是在企業防火牆/代理...這是沒有正確配置..此外,你的POM文件看起來不對,它包含絕對路徑...從來沒有使用這個... – khmarbaise

回答

0

你需要添加maven-resources-plugin插件,您可以精細下面的代碼:

<build> 
     <pluginManagement> 
      <plugins> 
      <plugin> 
       <artifactId>maven-resources-plugin</artifactId> 
       <version>2.7</version> 
      </plugin>   
      </plugins> 
     </pluginManagement> 
    </build> 

添加以下代碼到settins.xml

<proxy> 
     <id>optional</id> 
     <active>true</active> 
     <protocol>http</protocol> 
     <username>optional-proxyUser</username> 
     <password>optional-proxyPassword</password> 
     <host>proxy.host.net</host> 
     <port>80</port> 
     <nonProxyHosts>some.demo.com</nonProxyHosts> 
    </proxy> 

在此之後添加settings.xml到項目:轉到首選項>的Maven>用戶設置>選擇您的settings.xml並點擊應用和確定。

+0

對不起,請提供pom.xml的錯誤部分。 pom已經有了這些代碼,設置與我的相同,只是沒有用戶名和密碼標籤,已經選擇了正確的設置,仍然存在問題:( –

+0

然後嘗試將settings.xml添加到項目中:goto Preferences> Maven>用戶設置>選擇您的settings.xml並點擊應用和確定。 – Sharma

+0

已經完成,同樣的結果 –