Run-Others-Java-Projects

🤔 如何运行别人的 Java 项目

[TOC]

刚到公司,导师给了一个 Java 项目,搞了一下午没搞定。(卒)

⤵️ 1. 克隆项目仓库

首先使用 GitLab 将代码拉取下来。

1
2
NilEra@MS-202109171212 MINGW64 /d/LocalGit
$ git clone https://<username>:<access token>@git.xxx.com/...projectName.git

2. 配置项目信息

idea 打开项目后,进入 idea 进行配置。

主要注意:JDK 版本一般是 JDK1.8maven 需要选择自己的 maven,这里我的版本为 3.6.1,如果使用 Idea 自带的 maven(虽然版本也是 3.6.1),但是可能会导致一些问题,这里我遇到的包括但不限于:

  • 明明有错误但是 Reimport 后检测不出错误
  • 有一些包没法正常的安装
  • 有一些包虽然正常安装了,但是却没法正常检测
  • 总之就是非常多的坑

选择 POM 文件,右键 Add as Maven Project

Add

Node版本不适应,node 12-14

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
npm ERR! code 1
npm ERR! path D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: D:\nvm\nodejs\node.exe D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli 'D:\\nvm\\nodejs\\node.exe',
npm ERR! gyp verb cli 'D:\\Inspur\\LocalGit\\base-vap\\src\\frontend\\web\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.20.2 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21)
npm ERR! gyp verb `which` failed python2 Error: not found: python2
npm ERR! gyp verb `which` failed at getNotFoundError (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-gyp\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed at FSReqCallback.oncomplete (node:fs:202:21) {
npm ERR! gyp verb `which` failed code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python D:\Python311\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: D:\Python311\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack File "<string>", line 1
npm ERR! gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! gyp ERR! stack SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:402:12)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19043
npm ERR! gyp ERR! command "D:\\nvm\\nodejs\\node.exe" "D:\\Inspur\\LocalGit\\base-vap\\src\\frontend\\web\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\Inspur\LocalGit\base-vap\src\frontend\web\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.20.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! D:\nodejs\node_cache\_logs\2024-10-17T07_55_40_886Z-debug-0.log
作者

NilEra

发布于

2024-10-17

更新于

2024-10-21

许可协议

评论