Skip to content

Commit 35aa813

Browse files
committed
Add property for classifier-specific subdirs
This maps artifact classifiers to particular subdirectories. Our use case, as illustrated by the defaults, is to put platform-specific artifacts into isolated subfolders, since this is what Fiji wants. But the property can be overridden in POM configuration.
1 parent 71c230c commit 35aa813

File tree

8 files changed

+489
-1
lines changed

8 files changed

+489
-1
lines changed
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<!--
2+
#%L
3+
A plugin for managing SciJava-based projects.
4+
%%
5+
Copyright (C) 2014 - 2020 SciJava developers.
6+
%%
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
1. Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
POSSIBILITY OF SUCH DAMAGE.
27+
#L%
28+
-->
29+
30+
<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">
31+
<modelVersion>4.0.0</modelVersion>
32+
33+
<groupId>org.apache.maven.plugin.my.unit</groupId>
34+
<artifactId>custom-subdirectories</artifactId>
35+
<version>1.0.0-SNAPSHOT</version>
36+
<name>A project with dependencies sorted to custom subdirectories</name>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.lwjgl</groupId>
41+
<artifactId>lwjgl</artifactId>
42+
<version>${lwjgl.version}</version>
43+
<classifier>natives-linux</classifier>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.lwjgl</groupId>
47+
<artifactId>lwjgl</artifactId>
48+
<version>${lwjgl.version}</version>
49+
<classifier>natives-macos</classifier>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.lwjgl</groupId>
53+
<artifactId>lwjgl</artifactId>
54+
<version>${lwjgl.version}</version>
55+
<classifier>natives-windows</classifier>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.lwjgl</groupId>
59+
<artifactId>lwjgl</artifactId>
60+
<version>${lwjgl.version}</version>
61+
<classifier>natives-windows-x86</classifier>
62+
</dependency>
63+
</dependencies>
64+
65+
<properties>
66+
<scijava.app.directory>${project.basedir}/target/ImageJ.app/</scijava.app.directory>
67+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
68+
<lwjgl.version>3.2.3</lwjgl.version>
69+
</properties>
70+
71+
<build>
72+
<plugins>
73+
<plugin>
74+
<groupId>org.scijava</groupId>
75+
<artifactId>scijava-maven-plugin</artifactId>
76+
<version>${scijava-maven.version}</version>
77+
<configuration>
78+
<subdirectoryPatterns>
79+
<subdirectoryPattern>
80+
<name>open</name>
81+
<classifiers>
82+
<classifier>natives-linux</classifier>
83+
</classifiers>
84+
</subdirectoryPattern>
85+
<subdirectoryPattern>
86+
<name>closed</name>
87+
<classifiers>
88+
<classifier>natives-macos</classifier>
89+
<classifier>natives-windows</classifier>
90+
<classifier>natives-windows-x86</classifier>
91+
</classifiers>
92+
</subdirectoryPattern>
93+
</subdirectoryPatterns>
94+
</configuration>
95+
<executions>
96+
<execution>
97+
<id>populate-app</id>
98+
<phase>install</phase>
99+
<goals>
100+
<goal>populate-app</goal>
101+
</goals>
102+
</execution>
103+
</executions>
104+
</plugin>
105+
</plugins>
106+
</build>
107+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* #%L
3+
* A plugin for managing SciJava-based projects.
4+
* %%
5+
* Copyright (C) 2014 - 2020 SciJava developers.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
29+
source(new File(basedir, "../../../src/it/lib.bsh").getPath());
30+
31+
if (!ijDir.exists()) ijDir.mkdirs();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* #%L
3+
* A plugin for managing SciJava-based projects.
4+
* %%
5+
* Copyright (C) 2014 - 2020 SciJava developers.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
29+
source(new File(basedir, "../../../src/it/lib.bsh").getPath());
30+
31+
assertTrue("Missing linux lwjgl library", new File(ijDir, "open/lwjgl-3.2.3-natives-linux.jar").exists());
32+
assertTrue("Missing macos lwjgl library", new File(ijDir, "closed/lwjgl-3.2.3-natives-macos.jar").exists());
33+
assertTrue("Missing windows-x86 lwjgl library", new File(ijDir, "closed/lwjgl-3.2.3-natives-windows-x86.jar").exists());
34+
assertTrue("Missing windows lwjgl library", new File(ijDir, "closed/lwjgl-3.2.3-natives-windows.jar").exists());
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!--
2+
#%L
3+
A plugin for managing SciJava-based projects.
4+
%%
5+
Copyright (C) 2014 - 2020 SciJava developers.
6+
%%
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are met:
9+
10+
1. Redistributions of source code must retain the above copyright notice,
11+
this list of conditions and the following disclaimer.
12+
2. Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
POSSIBILITY OF SUCH DAMAGE.
27+
#L%
28+
-->
29+
30+
<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">
31+
<modelVersion>4.0.0</modelVersion>
32+
33+
<groupId>org.apache.maven.plugin.my.unit</groupId>
34+
<artifactId>library-needing-lwjgl-natives</artifactId>
35+
<version>1.0.0-SNAPSHOT</version>
36+
<name>An example project depending on lwjgl native artifacts</name>
37+
38+
<dependencies>
39+
<dependency>
40+
<groupId>org.lwjgl</groupId>
41+
<artifactId>lwjgl</artifactId>
42+
<version>${lwjgl.version}</version>
43+
<classifier>natives-linux</classifier>
44+
</dependency>
45+
<dependency>
46+
<groupId>org.lwjgl</groupId>
47+
<artifactId>lwjgl</artifactId>
48+
<version>${lwjgl.version}</version>
49+
<classifier>natives-macos</classifier>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.lwjgl</groupId>
53+
<artifactId>lwjgl</artifactId>
54+
<version>${lwjgl.version}</version>
55+
<classifier>natives-windows</classifier>
56+
</dependency>
57+
<dependency>
58+
<groupId>org.lwjgl</groupId>
59+
<artifactId>lwjgl</artifactId>
60+
<version>${lwjgl.version}</version>
61+
<classifier>natives-windows-x86</classifier>
62+
</dependency>
63+
</dependencies>
64+
65+
<properties>
66+
<scijava.app.directory>${project.basedir}/target/ImageJ.app/</scijava.app.directory>
67+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
68+
<lwjgl.version>3.2.3</lwjgl.version>
69+
</properties>
70+
71+
<build>
72+
<plugins>
73+
<plugin>
74+
<groupId>org.scijava</groupId>
75+
<artifactId>scijava-maven-plugin</artifactId>
76+
<version>${scijava-maven.version}</version>
77+
<executions>
78+
<execution>
79+
<id>populate-app</id>
80+
<phase>install</phase>
81+
<goals>
82+
<goal>populate-app</goal>
83+
</goals>
84+
</execution>
85+
</executions>
86+
</plugin>
87+
</plugins>
88+
</build>
89+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* #%L
3+
* A plugin for managing SciJava-based projects.
4+
* %%
5+
* Copyright (C) 2014 - 2020 SciJava developers.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
29+
source(new File(basedir, "../../../src/it/lib.bsh").getPath());
30+
31+
if (!ijDir.exists()) ijDir.mkdirs();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* #%L
3+
* A plugin for managing SciJava-based projects.
4+
* %%
5+
* Copyright (C) 2014 - 2020 SciJava developers.
6+
* %%
7+
* Redistribution and use in source and binary forms, with or without
8+
* modification, are permitted provided that the following conditions are met:
9+
*
10+
* 1. Redistributions of source code must retain the above copyright notice,
11+
* this list of conditions and the following disclaimer.
12+
* 2. Redistributions in binary form must reproduce the above copyright notice,
13+
* this list of conditions and the following disclaimer in the documentation
14+
* and/or other materials provided with the distribution.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
20+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26+
* POSSIBILITY OF SUCH DAMAGE.
27+
* #L%
28+
*/
29+
source(new File(basedir, "../../../src/it/lib.bsh").getPath());
30+
31+
assertTrue("Missing linux64 lwjgl library", new File(ijDir, "jars/linux64/lwjgl-3.2.3-natives-linux.jar").exists());
32+
assertTrue("Missing macosx lwjgl library", new File(ijDir, "jars/macosx/lwjgl-3.2.3-natives-macos.jar").exists());
33+
assertTrue("Missing win32 lwjgl library", new File(ijDir, "jars/win32/lwjgl-3.2.3-natives-windows-x86.jar").exists());
34+
assertTrue("Missing win64 lwjgl library", new File(ijDir, "jars/win64/lwjgl-3.2.3-natives-windows.jar").exists());

0 commit comments

Comments
 (0)