Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
eclipse maven外部JAR无法编译_Eclipse_Maven - Fatal编程技术网

eclipse maven外部JAR无法编译

eclipse maven外部JAR无法编译,eclipse,maven,Eclipse,Maven,即使将外部JAR添加到eclipse中,Maven编译也会失败。我的Eclipse代码可以使用外部JAR,但是当我编译Maven时,会抱怨没有找到包,我有将近50个外部包 稍后我将使用mvn依赖项添加JAR 然而,它应该起作用,但不是运气。 请提供任何疑难解答/建议。我认为如果您的pom.xml中没有标记(无论您是从eclipse还是从命令行运行它),您就无法摆脱Maven项目。对于依赖于来自50个外部jar的类的项目来说也是如此。 如果您不想让maven查找这些JAR,您必须在pom.xml中

即使将外部JAR添加到eclipse中,Maven编译也会失败。我的Eclipse代码可以使用外部JAR,但是当我编译Maven时,会抱怨没有找到包,我有将近50个外部包

稍后我将使用mvn依赖项添加JAR

然而,它应该起作用,但不是运气。
请提供任何疑难解答/建议。

我认为如果您的
pom.xml
中没有
标记(无论您是从eclipse还是从命令行运行它),您就无法摆脱
Maven项目。对于依赖于来自50个外部jar的类的项目来说也是如此。
如果您不想让maven查找这些JAR,您必须在
pom.xml
中添加以下条目,其中包含
系统范围

<dependencies>
 <dependency>
  <groupId>selenium-server-standalone</groupId>
  <artifactId>selenium-server-standalone</artifactId>
  <version>2.46.0</version>
  <scope>system</scope>
  <systemPath>${project.basedir}/lib/selenium-server-standalone-2.46.0.jar</systemPath>
</dependency>
</dependencies> 

selenium服务器单机版
selenium服务器单机版
2.46.0
系统
${project.basedir}/lib/selenium-server-standalone-2.46.0.jar

这样一来,groupID和artifactID就没有意义了。您可以编写这样的50个
标记来引用50个外部jar

据我所知,Maven将首先在
user/.m2
本地存储库中查找外部JAR中的包。如果没有找到,它将进入maven的中央存储库。所有这些重新定向都由
maven依赖性处理
。但由于您跳过了整个依赖项,它将无法找到所需的类。请尝试在下面给出解决方案,将其作为答案发布,因为太大,无法添加到注释中。