2

I am trying to import RinSim 3.2.2 from Maven using IntelliJ IDEA. I'm running Windows 8.1 x64. The following is my POM file:

<?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>

The same POM file imports the library correctly in Eclipse, but when calling the Reimport function from within IntelliJ it resolves the dependencies incorrectly. The library depends on the SWT UI library, which is platform dependent. IntelliJ imports the 32-bit version on Windows instead of the 64-bit version. The architecture is selected using profiles in the POM file of RinSim's UI library.

I hacked around this issue by modifying my POM file to hardcode in the 64-bit dependency, but this is not a clean solution.

<?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>

I'm trying to find out what causes the issue, the library's POM file seems to be correct. Perhaps IntelliJ has a bug causing this behavior, but I am unsure if that's the case.

I hope someone can offer me a solution to this problem or help me figure out the cause of the issue.

rinde
  • 1,181
  • 1
  • 8
  • 20
FHannes
  • 783
  • 7
  • 22
  • Not entirely sure, but I think Idea may be running in a 32bit JVM which will automatically activate the x86 profile due to how the [`os.arch` property seems to be evaluated](http://stackoverflow.com/questions/4748673/how-can-i-check-the-bitness-of-my-os-using-java-j2se-not-os-arch/5940770#5940770). I suspect that if you change the Idea JRE to an x64 version it will pick the correct profile. Otherwise you should be able to select the active profiles from the [**Maven Projects** tool window under *Profiles*](https://www.jetbrains.com/idea/help/activating-and-deactivating-maven-profiles.html) – Morfic Apr 22 '15 at 11:24

1 Answers1

2

The problem is that IntelliJ is running on a bundled 32-bit JVM by default.

Use the idea64.exe instead of the idea.exe. The executables can be found in C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.x.x\bin.

I tried it out and it works as expected.

maba
  • 47,113
  • 10
  • 108
  • 118