【问题标题】:How do I get IntelliJ IDEA to import RinSim from Maven correctly?如何让 IntelliJ IDEA 从 Maven 正确导入 RinSim?
【发布时间】:2015-06-29 21:02:27
【问题描述】:

我正在尝试使用 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 位版本。使用the POM file of RinSim's UI library 中的配置文件选择架构。

我通过修改我的 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 有一个导致这种行为的错误,但我不确定是否是这种情况。

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

【问题讨论】:

标签: java maven intellij-idea rinsim


【解决方案1】:

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

使用idea64.exe 而不是idea.exe。可执行文件位于C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.x.x\bin

我试过了,它按预期工作。

【讨论】:

    猜你喜欢
    • 2018-03-07
    • 2019-09-22
    • 2013-10-20
    • 2017-07-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-08
    相关资源
    最近更新 更多