eclipse Maven:将外部 jar 文件夹添加到类路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36176415/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven: add external jar folder to classpath
提问by Stefano R.
I've simple Eclipse Web Project based on Adobe framework. Now I have to upgrade my project to a new version of framework and I wish to use Maven to manage dependencies, packaging, ecc.
我有一个基于 Adobe 框架的简单 Eclipse Web 项目。现在我必须将我的项目升级到新版本的框架,我希望使用 Maven 来管理依赖项、打包、ecc。
The problem is that in the Adobe documentation is write that I MUST use thier own jars that are a lot (69). I see Maven System_Dependencies, but i'm looking for something smarter that add all 69 entries like that.
问题是,在 Adobe 文档中写道,我必须使用他们自己的大量 jar(69)。我看到了Maven System_Dependencies,但我正在寻找更智能的东西来添加所有 69 个条目。
Usually, I would create an Eclipse UserLibrary and would add to Eclipse BuildPath, but in this case I don't know how to add them to maven classpath to compile and package the project properly
通常,我会创建一个 Eclipse UserLibrary 并添加到 Eclipse BuildPath,但在这种情况下,我不知道如何将它们添加到 maven 类路径以正确编译和打包项目
回答by Rima
To include external jars you can add the dependency with Systemscope.
要包含外部 jar,您可以添加具有System范围的依赖项。
<dependency>
..
<scope>system<scope>
<systemPath>your jar path</systemPath>
</dependency>
Also you can define your compiler plugin to include the directory in your classpath.
您也可以定义编译器插件以将目录包含在类路径中。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<includes>
<include>directory path/*.jar</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
NOTE: This will make your build success. But not sure how to make those classes available for access inside IDE.
注意:这将使您的构建成功。但不确定如何使这些类可用于 IDE 内部访问。