Skip to content

Commit e773e9c

Browse files
committed
Merge pull request #15 from hazendaz/master
Update to use Maven Annotations
2 parents 01f8b06 + 433830a commit e773e9c

File tree

7 files changed

+149
-133
lines changed

7 files changed

+149
-133
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ target/*
55
.settings/*
66
.project
77
.classpath
8+
.factorypath
89
/target
910
.idea

pom.xml

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@
6464
<dependency>
6565
<groupId>org.apache.maven</groupId>
6666
<artifactId>maven-plugin-api</artifactId>
67-
<version>3.2.3</version>
67+
<version>3.2.5</version>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.apache.maven.plugin-tools</groupId>
71+
<artifactId>maven-plugin-annotations</artifactId>
72+
<version>3.3</version>
73+
<scope>provided</scope>
6874
</dependency>
6975
<dependency>
7076
<groupId>org.apache.maven</groupId>
@@ -79,12 +85,12 @@
7985
<dependency>
8086
<groupId>org.apache.maven</groupId>
8187
<artifactId>maven-plugin-descriptor</artifactId>
82-
<version>2.2.0</version>
88+
<version>2.2.1</version>
8389
</dependency>
8490
<dependency>
8591
<groupId>junit</groupId>
8692
<artifactId>junit</artifactId>
87-
<version>4.11</version>
93+
<version>4.12</version>
8894
<scope>test</scope>
8995
</dependency>
9096
</dependencies>
@@ -103,7 +109,7 @@
103109
<plugin>
104110
<groupId>org.apache.maven.plugins</groupId>
105111
<artifactId>maven-assembly-plugin</artifactId>
106-
<version>2.5</version>
112+
<version>2.5.3</version>
107113
<executions>
108114
<execution>
109115
<id>dist-src</id>
@@ -119,7 +125,66 @@
119125
</execution>
120126
</executions>
121127
</plugin>
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-plugin-plugin</artifactId>
131+
<version>3.3</version>
132+
<configuration>
133+
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
134+
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
135+
</configuration>
136+
<executions>
137+
<execution>
138+
<id>mojo-descriptor</id>
139+
<goals>
140+
<goal>descriptor</goal>
141+
</goals>
142+
</execution>
143+
<execution>
144+
<id>help-goal</id>
145+
<goals>
146+
<goal>helpmojo</goal>
147+
</goals>
148+
</execution>
149+
</executions>
150+
</plugin>
122151
</plugins>
152+
<pluginManagement>
153+
<plugins>
154+
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
155+
<plugin>
156+
<groupId>org.eclipse.m2e</groupId>
157+
<artifactId>lifecycle-mapping</artifactId>
158+
<version>1.0.0</version>
159+
<configuration>
160+
<lifecycleMappingMetadata>
161+
<pluginExecutions>
162+
<pluginExecution>
163+
<pluginExecutionFilter>
164+
<groupId>
165+
org.apache.maven.plugins
166+
</groupId>
167+
<artifactId>
168+
maven-plugin-plugin
169+
</artifactId>
170+
<versionRange>
171+
[3.3,)
172+
</versionRange>
173+
<goals>
174+
<goal>helpmojo</goal>
175+
<goal>descriptor</goal>
176+
</goals>
177+
</pluginExecutionFilter>
178+
<action>
179+
<ignore></ignore>
180+
</action>
181+
</pluginExecution>
182+
</pluginExecutions>
183+
</lifecycleMappingMetadata>
184+
</configuration>
185+
</plugin>
186+
</plugins>
187+
</pluginManagement>
123188
</build>
124189

125190
<reporting>
@@ -147,7 +212,7 @@
147212
<plugin>
148213
<groupId>org.apache.maven.plugins</groupId>
149214
<artifactId>maven-surefire-report-plugin</artifactId>
150-
<version>2.17</version>
215+
<version>2.18.1</version>
151216
</plugin>
152217
</plugins>
153218
</reporting>

src/main/java/com/akathist/maven/plugins/launch4j/ClassPath.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package com.akathist.maven.plugins.launch4j;
2020

2121
import org.apache.maven.artifact.Artifact;
22+
import org.apache.maven.plugins.annotations.Parameter;
2223

2324
import java.util.ArrayList;
2425
import java.util.Arrays;
@@ -29,56 +30,51 @@ public class ClassPath {
2930

3031
/**
3132
* The main class to run. This is not required if you are wrapping an executable jar.
32-
*
33-
* @parameter
3433
*/
34+
@Parameter
3535
String mainClass;
3636

3737
/**
3838
* The launch4j executable sets up a classpath before running your jar, but it must know what the
3939
* classpath should be. If you set this property to true, the plugin will indicate a classpath
4040
* based on all the dependencies your program will need at runtime. You can augment this classpath
4141
* using the preCp and postCp properties.
42-
*
43-
* @parameter default-value=true
4442
*/
43+
@Parameter(defaultValue="true")
4544
boolean addDependencies = true;
4645

4746
/**
4847
* If you want maven to build the classpath from dependencies, you can optionally set the jarLocation,
4948
* which is the location of the jars in your distro relative to the executable. So if your distro
5049
* has the exe at the top level and all the jars in a lib directory, you could set this to &quot;lib.&quot;
5150
* This property does not affect preCp and postCp.
52-
*
53-
* @parameter
5451
*/
52+
@Parameter
5553
String jarLocation;
5654

5755
/**
5856
* Part of the classpath that the executable should give to your application.
5957
* Paths are relative to the executable and should be in Windows format (separated by a semicolon).
6058
* You don't have to list all your dependencies here; the plugin will include them by default
6159
* after this list.
62-
*
63-
* @parameter
6460
*/
61+
@Parameter
6562
String preCp;
6663

6764
/**
6865
* Part of the classpath that the executable should give to your application.
6966
* Paths are relative to the executable and should be in Windows format (separated by a semicolon).
7067
* You don't have to list all your dependencies here; the plugin will include them by default
7168
* before this list.
72-
*
73-
* @parameter
7469
*/
70+
@Parameter
7571
String postCp;
7672

7773
private void addToCp(List<String> cp, String cpStr) {
7874
cp.addAll(Arrays.asList(cpStr.split("\\s*;\\s*")));
7975
}
8076

81-
net.sf.launch4j.config.ClassPath toL4j(Set dependencies, List runtimeDependencies) {
77+
net.sf.launch4j.config.ClassPath toL4j(Set<Artifact> dependencies, List<Artifact> runtimeDependencies) {
8278
net.sf.launch4j.config.ClassPath ret = new net.sf.launch4j.config.ClassPath();
8379
ret.setMainClass(mainClass);
8480

@@ -92,14 +88,13 @@ net.sf.launch4j.config.ClassPath toL4j(Set dependencies, List runtimeDependencie
9288
// Add all runtime dependencies as we need them to run the wrapped jar
9389
dependencies.addAll(runtimeDependencies);
9490

95-
for (Object dependency : dependencies) {
96-
Artifact dep = (Artifact) dependency;
97-
if (Artifact.SCOPE_COMPILE.equals(dep.getScope()) ||
98-
Artifact.SCOPE_RUNTIME.equals(dep.getScope())) {
91+
for (Artifact dependency : dependencies) {
92+
if (Artifact.SCOPE_COMPILE.equals(dependency.getScope()) ||
93+
Artifact.SCOPE_RUNTIME.equals(dependency.getScope())) {
9994

10095
String depFilename;
101-
depFilename = dep.getFile().getName();
102-
// System.out.println("dep = " + depFilename);
96+
depFilename = dependency.getFile().getName();
97+
// System.out.println("dependency = " + depFilename);
10398
cp.add(jarLocation + depFilename);
10499
}
105100
}

src/main/java/com/akathist/maven/plugins/launch4j/Jre.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
import java.util.List;
2222

23+
import org.apache.maven.plugins.annotations.Parameter;
24+
2325
/**
2426
* Details about which jre the executable should call.
2527
*/
@@ -79,9 +81,8 @@ public class Jre {
7981
* <td>Always use a private JDK runtime (fails if there is no JDK installed)</td>
8082
* </tr>
8183
* </table>
82-
*
83-
* @parameter default-value="preferJre"
8484
*/
85+
@Parameter(defaultValue="preferJre")
8586
String jdkPreference;
8687

8788
/**
@@ -120,9 +121,8 @@ public class Jre {
120121
* Sets JVM version to use: 32 bits, 64 bits or 64/32 bits
121122
* Possible values: 32, 64, 64/32 - it will fallback to default value if different option was used
122123
* Default value is: 64/32
123-
*
124-
* @parameter default-value="64/32"
125124
*/
125+
@Parameter(defaultValue="64/32")
126126
String runtimeBits;
127127

128128
net.sf.launch4j.config.Jre toL4j() {

0 commit comments

Comments
 (0)