mvn clean package -Dmaven.test.skip=true
如果提示
'mvn' 不是内部或外部命令,也不是可运行的程序或批处理文件。
需要去安装maven并配置环境变量,这个网上已经有很多教程了
言归正传,在执行时遇到了三个问题
1.首先是
[INFO] Installing node version v16.2.0
[INFO] Downloading https://nodejs.org/dist/v16.2.0/win-x64/node.exe to D:\ProgramData\repo\com\github\eirslett\node\16.2.0\node-16.2.0-win-x64.exe
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
它会卡在这,原因是代理服务器没有资源,这时候可以等一会,它会自动转为直接下载。或者选择自己手动下载,参考Downloading里面的下载地址,下载的文件放到to后面的文件目录中去,重新执行
2.然后又遇到了依赖项无资源可下载的问题
[ERROR] Failed to execute goal on project rocketmq-dashboard: Could not resolve dependencies for project org.apache.rocketmq:rocketmq-dashboard:jar:1.0.1-SNAPSHOT: Could not find artifact com.sun.xml.bind:jaxb-core:jar:2.3.1 in aliyunMavenRepositoryPublic (https://maven.aliyun.com/repository/public) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
这时候需要更改pom.xml文件里报错的依赖的version,我这里是直接将
<jaxb-api.version>2.3.1</jaxb-api.version>
修改为
<jaxb-api.version>2.3.0</jaxb-api.version>
并且添加了jaxb-api以外的别的依赖,具体如下
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>${jaxb-api.version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
3.最后遇到
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.11.3:yarn (yarn install) on project rocketmq-dashboard: Failed to run task: 'yarn install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
最后是将pom.xml中的frontend-maven-plugin和maven-antrun-plugin插件注释掉就能打包成功了