2

我正在尝试使用 IntelliJ IDEA 从 Maven导入RinSim 3.2.2。我正在运行 Windows 8.1 x64。以下是我的 POM 文件:

<?xml version="1.0" encoding="UTF-8"?>
<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>be.kuleuven.cs</groupId>
    <artifactId>Multi-Agent_Systems</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>com.github.rinde</groupId>
            <artifactId>rinsim-example</artifactId>
            <version>3.2.2</version>
        </dependency>
    </dependencies>
</project>

相同的 POM 文件在 Eclipse 中正确导入库,但是从 IntelliJ 中调用 Reimport 函数时,它会错误地解析依赖项。该库依赖于平台相关的 SWT UI 库。IntelliJ 在 Windows 上导入 32 位版本而不是 64 位版本。使用RinSim UI 库的 POM 文件中的配置文件选择架构。

我通过将我的 POM 文件修改为 64 位依赖项中的硬编码来解决这个问题,但这不是一个干净的解决方案。

<?xml version="1.0" encoding="UTF-8"?>
<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>be.kuleuven.cs</groupId>
    <artifactId>Multi-Agent_Systems</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
            <version>4.4</version>
        </dependency>
        <dependency>
            <groupId>com.github.rinde</groupId>
            <artifactId>rinsim-example</artifactId>
            <version>3.2.2</version>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.swt</groupId>
                    <artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>swt-repo</id>
            <name>SWT Repo</name>
            <url>https://swt-repo.googlecode.com/svn/repo/</url>
        </repository>
    </repositories>
</project>

我试图找出导致问题的原因,库的 POM 文件似乎是正确的。也许 IntelliJ 有一个导致这种行为的错误,但我不确定是否是这种情况。

我希望有人可以为我提供解决此问题的方法或帮助我找出问题的原因。

4

1 回答 1

2

问题是 IntelliJ 默认运行在捆绑的 32 位 JVM 上。

使用idea64.exe代替idea.exe。可执行文件可以在C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.x.x\bin.

我试了一下,它按预期工作。

于 2015-04-22T11:27:44.593 回答