windows 使用 IDEA,通过 maven 打包一个开源项目的求助

86 天前
 baiyekaslana

https://github.com/devlive-community/datacap.git 本地打算源码打包安装 datacap 项目,但是现在 jdk 使用 1.8 版本的话,后面打包就会提示 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (java-compile) on project datacap-captcha: Fatal error compiling: 无效的目标发行版: 11 -> [Help 1] 让你使用 jdk11. 要是使用 jdk11 的话,开始就会提示无法找到 tools.jar,要用 tools.jar 就得换回 jdk1.8 我想知道这个开源项目源码到底要怎么打包。

1792 次点击
所在节点    Java
31 条回复
ikas
83 天前
这个实际是 yarn --legacy-peer-deps install 执行失败了, 应该是前端项目的依赖无法下载把
手动到 datacap-ui 模块执行 yarn --legacy-peer-deps install 试试
baiyekaslana
83 天前
@ikas 这个是当时执行的。
[INFO] datacap-notify-dingtalk ............................ SUCCESS [ 0.269 s]
[INFO] datacap-server ..................................... FAILURE [02:27 min]
[INFO] datacap-jdbc-mongo ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:51 min
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.15.0:yarn (yarn install) on project datacap-server: Failed to run task: 'yarn --legacy-peer-deps 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]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :datacap-server
baiyekaslana
83 天前
@ikas 应该是 datacap-server 的模块无法下载,datacap-ui 的我还没拉。
baiyekaslana
83 天前
@ikas 您说的这个手动到模块下执行 yarn --legacy-peer-deps install ,是说的 maven 那个对应的模块里输入这个命令嘛?
baiyekaslana
83 天前
@baiyekaslana
@ikas 我搜了下,是在对应的模块目录下的终端执行是吗
ikas
83 天前
打开目录 datacap\core\datacap-ui
然后使用在该目录,使用 cmd 执行 yarn --legacy-peer-deps install

这个已经不是 java 与 maven 了,而是前端编译
baiyekaslana
83 天前
@ikas 我看文件里自带 package-lock.json ,这个是 npm 使用的锁文件吧,程序用 yarn 不会相互影响嘛
baiyekaslana
83 天前
@ikas

PS C:\Users\baiye\Desktop\datacap_dev\datacap\core\datacap-ui> yarn --legacy-peer-deps install
yarn install v1.22.22
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 153.99s.
PS C:\Users\baiye\Desktop\datacap_dev\datacap\core\datacap-ui>
ikas
83 天前
前端依赖下载好了.回到 maven 去编译把
baiyekaslana
83 天前
@ikas
现在好了,为啥需要手动编译前端文件才行,他自己那个命令就会报错?
[INFO] datacap-notify-spi ................................. SUCCESS [ 0.231 s]
[INFO] datacap-http ....................................... SUCCESS [ 0.620 s]
[INFO] datacap-notify-dingtalk ............................ SUCCESS [ 0.314 s]
[INFO] datacap-server ..................................... SUCCESS [01:11 min]
[INFO] datacap-jdbc-mongo ................................. SUCCESS [ 0.628 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:42 min
[INFO] Finished at: 2024-09-30T14:52:42+08:00
[INFO] ------------------------------------------------------------------------
PS C:\Users\baiye\Desktop\datacap_dev\datacap>
ikas
83 天前
主要是国内网络限制...

你手动执行,也有提示
[2/4] Fetching packages...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...
info There appears to be trouble with your network connection. Retrying...


你用 maven 多执行几次,可能也会成功,但是那样太慢了...所以手动执行,先把依赖(datacap-ui\node_modules)下载下来...

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1076400

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX