Note that there are some explanatory texts on larger screens.

plurals
  1. POBuild multiple architecture SWT application with Maven
    text
    copied!<p>I've set up a Maven project for a SWT application. This application runs on several platforms (OS X, Windows 64-bit, Windows 32-bit, Linux 64-bit and Linux 32-bit) and I've set it up so that the platform is detected when Maven is run and the packaged application goes to different destination directories. Here are the relevant parts from pom.xml to achieve this:</p> <pre><code>&lt;profiles&gt; &lt;profile&gt; &lt;id&gt;linux_x86_64&lt;/id&gt; &lt;activation&gt; &lt;os&gt; &lt;name&gt;linux&lt;/name&gt; &lt;arch&gt;amd64&lt;/arch&gt; &lt;/os&gt; &lt;/activation&gt; &lt;build&gt; &lt;directory&gt;${project.basedir}/target/${project.version}/linux_x86_64&lt;/directory&gt; &lt;/build&gt; &lt;/profile&gt; &lt;profile&gt; &lt;id&gt;win32_x86_64&lt;/id&gt; &lt;activation&gt; &lt;os&gt; &lt;name&gt;linux&lt;/name&gt; &lt;arch&gt;i386&lt;/arch&gt; &lt;/os&gt; &lt;/activation&gt; &lt;build&gt; &lt;directory&gt;${project.basedir}/target/${project.version}/win32_x86_64&lt;/directory&gt; &lt;/build&gt; &lt;/profile&gt; ... &lt;/profiles&gt; </code></pre> <p>And the dependency used for SWT is this:</p> <pre><code>&lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.eclipse&lt;/groupId&gt; &lt;artifactId&gt;swt&lt;/artifactId&gt; &lt;version&gt;3.7.2.v3740&lt;/version&gt; &lt;/dependency&gt; ... &lt;/dependencies&gt; </code></pre> <p>To make things clear, I have installed in my local repository the SWT dummy package (org.eclipse.swt_3.7.2.v3740f.jar) and <em>all</em> the platform-specific ones (org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f, org.eclipse.swt.win32.x86_64_3.7.2.v3740f, etc.).</p> <p>The way I pack dependencies is with a "lib" folder using the maven-dependency-plugin and Maven is smart enough to copy both the SWT dummy package and the platform-specific one of the machine where I'm packaging the application. So far so good...</p> <p>The problem is that I would like to compile the application for the different platforms from a single machine. How would I achieve this?</p> <p>I've tried setting up a property in each profile with the SWT jar needed for each platform, like this (example for Windows 64-bit):</p> <pre><code>&lt;properties&gt; &lt;swt.artifactId&gt;swt.win32.x86_64&lt;/swt.artifactId&gt; &lt;swt.version&gt;3.7.2&lt;/swt.version&gt; &lt;/properties&gt; </code></pre> <p>But taking this approach both the profile-specific SWT jar <em>and</em> the platform-specific one where I'm running Maven get copied into the "lib" directory, ending up with three jars:</p> <ul> <li>swt-3.7.2.v3740.jar</li> <li>swt.gtk.linux.x86_64-3.7.2.jar</li> <li>swt.win32.x86_64-3.7.2.jar</li> </ul> <p>Is there a way in which I could specify a profile ignoring the machine where I'm running it so that I don't need to manually remove its SWT jar?</p> <p>Thanks in advance.</p>
 

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