如何解决maven构建错误无法执行目标com.github.eirslett?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何解决maven构建错误无法执行目标com.github.eirslett?相关的知识,希望对你有一定的参考价值。

我正在按照下面的例子来做 这个 链接来开发一个简单的crud应用程序。

一切都很好,直到我尝试用-Pprod参数运行它,使它作为一个单独的应用程序运行。

./mvnw spring-boot:run -Pprod 

然后就出现了这个错误

ERROR] error Command "build" not found.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.571 s
[INFO] Finished at: 2020-04-21T23:18:42-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:yarn (yarn build) on project licensing-app: Failed to run task: 'yarn build' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]

这里是pom.xml的相关部分。

   <id>prod</id>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/classes/static</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>app/build</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>${frontend-maven-plugin.version}</version>
                <configuration>
                    <workingDirectory>app</workingDirectory>
                </configuration>
                <executions>
                    <execution>
                        <id>install node</id>
                        <goals>
                            <goal>install-node-and-yarn</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>${node.version}</nodeVersion>
                            <yarnVersion>${yarn.version}</yarnVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <id>yarn install</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <phase>generate-resources</phase>
                    </execution>
                    <execution>
                        <id>yarn test</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <arguments>test</arguments>
                            <environmentVariables>
                                <CI>true</CI>
                            </environmentVariables>
                        </configuration>
                    </execution>
                    <execution>
                        <id>yarn build</id>
                        <goals>
                            <goal>yarn</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <arguments>build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <properties>
        <spring.profiles.active>prod</spring.profiles.active>
    </properties>
</profile>

你知道是什么原因导致的吗?

答案

我刚刚尝试了克隆repo,然后运行你提到的命令:.mvnw spring-boot:..:

git clone git@github.com:oktadeveloper/okta-spring-boot-react-crud-example.git

然后运行你提到的命令

cd okta-spring-boot-react-crud-example
./mvnw spring-boot:run -Pprod

在我的机器上运行!

以上是关于如何解决maven构建错误无法执行目标com.github.eirslett?的主要内容,如果未能解决你的问题,请参考以下文章

构建项目时出现错误,无法执行目标 org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs)

无法执行目标 com.spotify:dockerfile-maven-plugin:1.3.6:build on project 'foo':无法构建映像:

Maven组件插件无法执行问题,怎么解决

无法执行目标org.apache.maven.plugins:maven-deploy-plugin:2.7:在项目上部署default-deploy

解决maven插件问题:'无法加载mojo'

Maven错误:无法执行目标org.codehaus.mojo:exec-maven-plugin:1.2.1:exec