网上找了很多贴了,试了N中方法,都无效,包括如下:
1.File→project structure→libraries→+jar包,只能解决代码依赖,不能解决编译打包问题
2.File→project structure→Modules→Denpendencies→+jar包, 效果同1
3. 把jar包目录加入环境变量path、classpath等,无效
4.pom.xml文件增加packaging标签,如下图,虽然编译通过,但没有生成class文件,经过了解,设置成pom一般是父工程,要包含子模块的,一般的maven工程默认为jar的打包方式
所以方法4也无效
终极解决方案来了!!!!!!!!!!!!!
需要根据报错提示,找出依赖的jar包名称,然后在pom文件中加入依赖项,如下所示
<properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><piler.encoding>UTF-8</piler.encoding><java.version>11</java.version><piler.source>11</piler.source><piler.target>11</piler.target><releaselib_dir>D:\xxx\realease-libs\</releaselib_dir></properties><dependencies><dependency><groupId>aterm</groupId><artifactId>aterm-java</artifactId><version>1.8.2</version><scope>system</scope><systemPath>${releaselib_dir}aterm-java-1.8.2-p1.jar</systemPath></dependency></dependencies>
再次编译,会提示别的jar包不存在,再根据上面方法找出对应jar包,加入依赖,直到编译通过。