Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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
Java 从自定义Eclipse版本(Repast)向Maven添加依赖项_Java_Eclipse_Maven_Dependencies_Classpath - Fatal编程技术网

Java 从自定义Eclipse版本(Repast)向Maven添加依赖项

Java 从自定义Eclipse版本(Repast)向Maven添加依赖项,java,eclipse,maven,dependencies,classpath,Java,Eclipse,Maven,Dependencies,Classpath,我目前正在使用Repast进行一个模拟项目。它是一个定制的eclipse版本,带有用于实际模拟的内置库 我现在想用这个做一个maven项目。但是,我不知道如何将Repast库包含到我的pom.xml中,因为mvnrepository中既没有条目,也没有包含在我的项目文件夹中。它们都来自repast插件,位于我的eclipse安装中,如下所示: 这就是我的pom.xml现在的样子: <project xmlns="http://maven.apache.org/POM/4.0.0" xml

我目前正在使用Repast进行一个模拟项目。它是一个定制的eclipse版本,带有用于实际模拟的内置库

我现在想用这个做一个maven项目。但是,我不知道如何将Repast库包含到我的pom.xml中,因为mvnrepository中既没有条目,也没有包含在我的项目文件夹中。它们都来自repast插件,位于我的eclipse安装中,如下所示:

这就是我的pom.xml现在的样子:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>Simulation</groupId>
  <artifactId>Simulation</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>Simulation</name>
  <url>http://maven.apache.org</url>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <outputDirectory>bin</outputDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <archive>
            <manifest>
              <mainClass>simulation.app.UserMain</mainClass>
              <addClasspath>true</addClasspath>
            </manifest>
          </archive>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
        <executions>
          <execution>
            <id>make-assembly</id> 
            <phase>package</phase> 
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <!-- some other dependencies that are required -->
  </dependencies>
</project>

4.0.0
模拟
模拟
0.0.1-快照
罐子
模拟
http://maven.apache.org
src
箱子
maven汇编插件
simulation.app.UserMain
真的
带有依赖项的jar
组装
包裹
单一的
我的类路径中对应的条目如下:

<classpathentry kind="con" path="REPAST_SIMPHONY_SUPPORT"/>

但我如何将其应用到我的maven项目中呢? 每当我运行maven构建过程时,生成的JAR就会以“NoClassDefFoundErrors”终止。当我用WinRaR打开JAR文件时,我看到repast库不在其中


有人知道如何解决这个问题吗?提前谢谢

这是由于存在代码所依赖的类文件,并且该类文件在编译时存在,但在运行时找不到。查找构建时和运行时类路径中的差异

您可以参考此链接:

如本文所述:

EclipseMaven管理的依赖项中包含的JAR不是 包含在与关联的默认启动器使用的类路径中 就餐计划。因此,在有Maven的情况下启动项目 依赖项将在重新分配搜索时导致NoClassDefFoundError 通过类路径查找注释

解决办法如下:

添加EclipseMaven托管的 启动文件的依赖项(位于launchers/[项目名称]中) 模型。启动)。将以下行添加到类路径条目:

<listEntry value="&lt;?xml version=&quot;1.0&quot;
encoding=&quot;UTF-8&quot;
standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry
containerPath=&quot;org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER&quot;
path=&quot;3&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>


Quick google search发现:是的,我知道那个帖子。但情况正好相反。他在问,如何将maven依赖项放入repast启动器,而不是将repast库放入maven构建。是的,我知道这篇文章。但情况正好相反。他在问,如何将maven依赖项放入repast启动器,而不是将repast库放入maven构建