我想使用Spring Boot和React JS构建一个Web应用程序(按照此处的教程)。 在pom.xml中,我添加了:
<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 clean package时,我遇到以下错误。Maven版本为3.0.5。
插件org.apache.maven.plugins:maven-resources-plugin:3.0.5或其依赖项之一无法解析:无法读取org.apache.maven.plugins:maven-resources-plugin:jar:3.0.5的工件描述符:在http://repo.maven.apache.org/maven2中找不到org.apache.maven.plugins:maven-resources-plugin:pom:3.0.5,已缓存在本地存储库中,只有在中央更新间隔已过或强制更新后才会重新尝试解决。
编辑: 我已将maven-resources-plugin标签中的版本更改为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>
错误:
[错误] 未能执行目标 com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn(安装Node和Yarn)在项目 ema 上:插件 com.github.eirslett:frontend-maven-plugin:1.2 需要 Maven 版本 3.1.0 -> [帮助1]