【发布时间】:2017-10-04 23:40:07
【问题描述】:
我目前正在使用 Repast 进行模拟项目。这是一个自定义的 Eclipse 版本,带有用于实际模拟的内置库。
我现在想用这个制作一个 Maven 项目。但是,我不知道如何将 Repast-libraries 包含到我的 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>
我的类路径中对应的条目是这样的:
<classpathentry kind="con" path="REPAST_SIMPHONY_SUPPORT"/>
但是我如何把它放到我的 maven 项目中呢? 每当我运行 maven 构建过程时,生成的 JAR 都会以“NoClassDefFoundErrors”终止。当我用 WinRaR 打开 JAR-File 时,我发现repast 库不在其中。
有人知道如何解决这个问题吗?提前致谢!
【问题讨论】:
-
是的,我知道那个帖子。但情况恰恰相反。他在问,如何将 maven 依赖项放入 repast 启动器,而不是将 repast-libraries 放入 maven 构建中。
标签: java eclipse maven dependencies classpath