Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven version ranges and suffixed versions in IntelliJ Idea
    text
    copied!<p><strong>Update #1</strong></p> <p>I am not sure if this a good solution, but as quick workaround i was able to get it built on maven-2.x/Idea by downgrading JFace from 3.3.0-I20070606-0010 to 3.2.1-M20060908-1000</p> <p><strong>Original Message</strong></p> <p>i am trying to develop SWT/JFace application with IntelliJ Idea 11.0.2 and Maven. The problem is: </p> <p>Idea uses internally something that looks like maven-2.x API, so it cannot handle properly suffixed versions (like "1.0-v666999" instead of plain "1.0") in version ranges, that are used in org.eclipse:jface maven artifact. However, maven-3.0 can handle them properly with ease.</p> <p>So, the mutually-exclusive questions are:</p> <ol> <li>How to tune Idea to use maven-3.0 as internal maven engine (so it could resolve all imports properly)</li> <li>How to "workaround" such version suffixes with maven-2.x tools so idea, JFace maven artifacts and maven itself could all play nicely together? <ol> <li>Is there a way to "map" versions for maven, like "1.0-v666999" -> "1.0" ?</li> <li>Is there a way to force usage of specific version of artifact?</li> <li>Your ideas - ?</li> </ol></li> </ol> <p>Here is example pom.xml that uses JFace which uses ranged versions:</p> <pre><code>&lt;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/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;repotest&lt;/groupId&gt; &lt;artifactId&gt;repotest&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;name&gt;Archetype - repotest&lt;/name&gt; &lt;url&gt;http://maven.apache.org&lt;/url&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;${swt.groupId}&lt;/groupId&gt; &lt;artifactId&gt;${swt.artifactId}&lt;/artifactId&gt; &lt;version&gt;3.3.0-v3346&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.eclipse&lt;/groupId&gt; &lt;artifactId&gt;jface&lt;/artifactId&gt; &lt;version&gt;3.3.0-I20070606-0010&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;mac&lt;/id&gt; &lt;activation&gt; &lt;os&gt; &lt;name&gt;mac os x&lt;/name&gt; &lt;/os&gt; &lt;/activation&gt; &lt;properties&gt; &lt;swt.groupId&gt;org.eclipse.swt.carbon&lt;/swt.groupId&gt; &lt;swt.artifactId&gt;macosx&lt;/swt.artifactId&gt; &lt;/properties&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;windows&lt;/id&gt; &lt;activation&gt; &lt;os&gt; &lt;family&gt;windows&lt;/family&gt; &lt;/os&gt; &lt;/activation&gt; &lt;properties&gt; &lt;swt.groupId&gt;org.eclipse.swt.win32.win32&lt;/swt.groupId&gt; &lt;swt.artifactId&gt;x86&lt;/swt.artifactId&gt; &lt;/properties&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;unix&lt;/id&gt; &lt;activation&gt; &lt;os&gt; &lt;family&gt;unix&lt;/family&gt; &lt;/os&gt; &lt;/activation&gt; &lt;properties&gt; &lt;swt.groupId&gt;org.eclipse.swt.gtk.linux&lt;/swt.groupId&gt; &lt;swt.artifactId&gt;x86&lt;/swt.artifactId&gt; &lt;/properties&gt; &lt;/profile&gt; &lt;/profiles&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;2.3.2&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.6&lt;/source&gt; &lt;target&gt;1.6&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt; &lt;version&gt;1.5&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;shade&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;filters&gt; &lt;filter&gt; &lt;artifact&gt;*:*&lt;/artifact&gt; &lt;excludes&gt; &lt;exclude&gt;META-INF/*.SF&lt;/exclude&gt; &lt;exclude&gt;META-INF/*.DSA&lt;/exclude&gt; &lt;exclude&gt;META-INF/*.RSA&lt;/exclude&gt; &lt;/excludes&gt; &lt;/filter&gt; &lt;/filters&gt; &lt;transformers&gt; &lt;transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"&gt; &lt;mainClass&gt;repotest.RootWindow&lt;/mainClass&gt; &lt;/transformer&gt; &lt;/transformers&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p>And here is the src/main/java/repotest/RootWindow.java file used by this pom.xml:</p> <pre><code>package repotest; import org.eclipse.swt.widgets.Display; import org.eclipse.jface.window.ApplicationWindow; public class RootWindow extends ApplicationWindow { public static void main(String[] args) { ApplicationWindow rootWindow = new RootWindow(); rootWindow.setBlockOnOpen(true); rootWindow.open(); Display.getCurrent().dispose(); } public RootWindow() { super(null); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload