Solution: dubbo-admin-ui build failed when using Maven packaging (Failed to execute goal com.github.eirslett:frontend-maven-plugin)

Posted by Nathaniel on Tue, 11 Jan 2022 18:06:18 +0100

When installing dubbo-admin, the Dubbo monitoring center, using maven to package projects has been reporting errors

  • Prompt dubbo-admin-ui build failed

Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.0:npm (npm install) on project dubbo-admin-ui: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 7

[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.9.0:npm (npm install) on project dubbo-admin-ui: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 7 (Exit value: 7) -> [Help 1]

It roughly means com. Github. Eirslett:frontend-maven-plugin:1.9

Then I searched for a solution, only saw that I downloaded the article using Ali's mirror instead, and tried to find it was not possible

Original article: https://www.jianshu.com/p/070ce0cf4360

Then I tried various methods, and finally I solved them by manually importing dependencies

Solution:

First, the ui module failed to build, so the POM for the ui module was found. XML

Found plug-in com that failed to import. Github. Eirslett:frontend-maven-plugin

Manually go to the remote repository to find the corresponding plug-in

Links: https://repo.maven.apache.org/maven2/com/github/eirslett/frontend-maven-plugin/

Download required jar packages

Create a 1.9.0 folder in the local maven repository and put the jar package in (version number)

Renamed just pom. The name of XML is frontend-maven-plugin-1.9.0.jar (corresponding version number)

Go to POM again. The XML modifies the corresponding configuration to match the folder, file name just created in the local repository

Then put

<goals>
	<goal>npm</goal>
</goals>

Delete them all

Prevent npm download of plug-ins when building

Full code:

<plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.9.0</version>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <configuration>
                            <nodeVersion>v9.11.1</nodeVersion>
                        </configuration>
                    </execution>
                    <!-- Install all project dependencies -->
                    <execution>
                        <id>npm install</id>
                        <!-- optional: default phase is "generate-resources" -->
                        <phase>generate-resources</phase>
                        <!-- Optional configuration which provides for running any npm command -->
                        <configuration>
                            <arguments>install</arguments>
                        </configuration>
                    </execution>
                    <!-- Build and minify static files -->
                    <execution>
                        <id>npm run build</id>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Then pack it in maven

Note that the official documentation gives you the best way to skip the testing phase

mvn clean package -Dmaven.test.skip=true


The general principle is that maven can't find the dependency in the remote warehouse, and we put it in the local warehouse with the dependency we found, building it first checks if the local warehouse has the required dependency.

Previously downloaded using npm download Plugin

So delete these and we can manually find dependent downloads from the remote maven repository to solve the problem

If you have any questions or suggestions, please correct them!

Topics: Dubbo github Maven