2017-04-27 67 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> 
相关问题