2017-04-27 66 views
0

我想建立使用彈簧啓動一個Web應用程序和反應JS(跟着教程here)。 在pom.xml中我加:無法讀取的org.apache.maven.plugins神器描述:Maven的資源 - 插件:罐子:3.0.5

<plugin> 
    <artifactId>maven-resources-plugin</artifactId> 
    <version>3.0.5</version> 
    <executions> 
     <execution> 
      <id>Copy frontend production build to resources</id> 
      <phase>package</phase> 
      <goals> 
       <goal>copy-resources</goal> 
      </goals> 
      <configuration> 
       <outputDirectory>${basedir}/target/classes</outputDirectory> 
       <resources> 
        <resource> 
         <directory>src/main/app/build/</directory> 
         <filtering>true</filtering> 
        </resource> 
       </resources> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

當執行MVN清潔套裝,我得到以下錯誤。 Maven版本是3.0.5。

Plugin org.apache.maven.plugins:maven-resources-plugin:3.0.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:3.0.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

編輯: 我已在在Maven的資源 - 插件標籤,Maven的版本改爲3.0.2,但現在我得到的錯誤:

<plugin> 
    <groupId>com.github.eirslett</groupId> 
    <artifactId>frontend-maven-plugin</artifactId> 
    <version>1.2</version> 
    <executions> 
     <execution> 
      <id>Install Node and Yarn</id> 
      <goals> 
       <goal>install-node-and-yarn</goal> 
      </goals> 
     </execution> 

     <execution> 
      <id>yarn install</id> 
      <goals> 
       <goal>yarn</goal> 
      </goals> 
      <configuration> 
       <arguments>install</arguments> 
      </configuration> 
     </execution> 

     <execution> 
      <id>Frontend production build</id> 
      <phase>package</phase> 
      <goals> 
       <goal>yarn</goal> 
      </goals> 
      <configuration> 
       <arguments>run build</arguments> 
      </configuration> 
     </execution> 
    </executions> 
    <configuration> 
     <nodeVersion>v7.2.0</nodeVersion> 
     <yarnVersion>v0.18.0</yarnVersion> 
     <installDirectory>.mvn</installDirectory> 
     <workingDirectory>src/main/app</workingDirectory> 
    </configuration> 
</plugin> 

錯誤:

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn (Install Node and Yarn) on project ema: The plugin com.github.eirslett:frontend-maven-plugin:1.2 requires Maven version 3.1.0 -> [Help 1]

+0

您需要更改版本3.0.2,因爲它是最新的。之後,你需要使用MVN包-U,例如重啓Maven構建。 -U將重新下載您的依賴關係。 – Sarief

+0

也在教程中使用3.0.1版本,所以你可能需要該版本。 – Sarief

回答

2

總而言之,你的問題在這裏:

<artifactId>maven-resources-plugin</artifactId> 
<version>3.0.5</version> 

這個版本是爲了傳達maven-resources-plugin的版本,而不是Maven的本身。

適用這裏的最新版本是3.0.2

我也建議您在整個Maven安裝升級到最新的3.5.0版本。

+0

如果我把 3.0.2我這裏得到一個錯誤前端,Maven的插件(1.2) –

+0

我得到:[錯誤]未能執行目標com.github.eirslett:前端 - Maven的插件:1.2:在項目ema上安裝節點和紗線(安裝節點和紗線):當更改爲3.0時,插件com.github.eirslett:frontend-maven-plugin:1.2需要Maven版本3.1.0 - > [Help 1] 。 2 –

+0

查看我答案的最後一行... –

0

我面臨同樣的問題,然後我改變代碼1.5.9.RELEASE現在運轉perfectlty

<parent> 
    <groupId>org.springframework.boot</groupId> 
    <artifactId>spring-boot-starter-parent</artifactId> 
    <version>1.5.9.RELEASE</version> 
    <relativePath/> <!-- lookup parent from repository --> 
</parent> 
相關問題