Note that there are some explanatory texts on larger screens.

plurals
  1. POMulti-platform multi-module builds with Maven
    primarykey
    data
    text
    <p>I have a large project which uses SWT on several different platforms like windows (32 and 64 bits), linux-gtk (32 and 64 bits) etc. The project has several modules in a simple structure:</p> <pre> project-parent +- core +- swt-bridge (uses SWT) +- module1 (uses swt-bridge module) +- module2 +- ... +- module17 (uses swt-bridge module) </pre> <p>I would like to be able to run my code from Eclipse on all the supported platforms. E.g. if I look at the <code>swt-bridge</code> module on a 32-bit Windows machine, it should have the 32-bit Windows SWT dependencies, and also have the required DLLs extracted to some directory which I can then add to <code>java.library.path</code>.</p> <p>I can specify different dependencies by defining profiles activated by <code>os.family</code> and <code>os.arch</code>.</p> <pre> &lt;profile> &lt;id>macos&lt;/id> &lt;activation> &lt;os> &lt;family>macosx&lt;/family> &lt;arch>x86&lt;/arch> &lt;/os> &lt;/activation> &lt;properties> &lt;swt.native.groupId>org.eclipse.swt.carbon.macosx&lt;/swt.native.groupId> &lt;swt.native.artifactId>x86&lt;/swt.native.artifactId> &lt;swt.native.version>3.5.1&lt;/swt.native.version> &lt;/properties> &lt;/profile> </pre> <p>I can also use the <code>maven-dependency-plugin</code> to extract any DLLs, .so files from the SWT JAR to <code>target/swtlib</code>, and use them from Eclipse.</p> <p>This works fine if I put the profiles in the <code>swt-bridge</code> module. But this way I cannot see the properties set by the active profile from other projects, so e.g. I cannot use the dependency plugin with these properties (which I would like to).</p> <p>I thought I could solve this by moving the profiles to the parent POM, and indeed, if I build the whole product, it works. But this way I cannot just build one module, because Maven will complain about missing properties.</p> <p>I'm pretty sure many people face this problem, so there must be a way to handle this properly in Maven. Can anyone tell me what it is?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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