-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathpom.xml
289 lines (275 loc) · 9.17 KB
/
pom.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pirola.maven.example</groupId>
<!-- Remember to use '-' as word separator. -->
<artifactId>maven-example-project-for-java</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<!-- Begin project description. -->
<name>Maven example project for Java</name>
<description>Maven example project that cover most of the maven lifecycle (validation source code, JAR package, ...)</description>
<inceptionYear>2015</inceptionYear>
<organization>
<name>Fabio Pirola</name>
<url>//pirola.org</url>
</organization>
<url>//pirola.org</url>
<developers>
<developer>
<id>ID...</id>
<name>Fabio Pirola</name>
<email>FABIO ...(N0T SPAM ME)... AT PIROLA DoT ORG</email>
<url>//pirola.org</url>
<roles>
<role>Developer</role>
</roles>
</developer>
</developers>
<!-- End project description. -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.vendor>pirola.org</project.vendor>
<project.mainClass>org.pirola.maven.example.MavenExample</project.mainClass>
</properties>
<!-- Fake URLs. This fake URL is used to fail search remote repository and
it use instead the local repository (see buildnumber-maven-plugin). -->
<scm>
<connection>scm:git:http://none</connection>
<url>scm:git:https://none</url>
</scm>
<!-- Begin dependencies. -->
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<!-- End dependencies. -->
<!-- Begin sonar profile. -->
<profiles>
<profile>
<!-- Sonar profile, useful for analyze/validate Java code. -->
<id>sonarqube</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- Example for H2 -->
<sonar.jdbc.url>
<!-- Local SonarQube docker address -->
jdbc:h2:tcp://localhost:9092/sonar
</sonar.jdbc.url>
<sonar.jdbc.username>sonar</sonar.jdbc.username>
<sonar.jdbc.password>sonar</sonar.jdbc.password>
<!-- Optional URL to server. Default value is http://localhost:9000 -->
<sonar.host.url>
<!-- Local SonarQube docker address -->
http://localhost:9000/
</sonar.host.url>
</properties>
</profile>
</profiles>
<!-- End sonar profile. -->
<build>
<defaultGoal>install</defaultGoal>
<!-- Jar output file name. -->
<finalName>maven-example-project-for-java</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/test/resources-filtered</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<!-- The -source argument for the Java compiler. 1.7 stand for Java
7. -->
<source>1.7</source>
<!-- The -target argument for the Java compiler. 1.7 stand for Java
7. -->
<target>1.7</target>
<!-- Show source locations where deprecated APIs are used. -->
<showDeprecation>true</showDeprecation>
<!-- Show compilation warnings. -->
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<id>verify-java-code</id>
<phase>verify</phase>
<configuration>
<encoding>UTF-8</encoding>
<!-- Output the detected violations to the console.. -->
<logViolationsToConsole>true</logViolationsToConsole>
<!-- Build should fail upon a violation (before has been logged). -->
<failsOnError>false</failsOnError>
<!-- Fail the build on a violation (after violation has been logged) -->
<failOnViolation>true</failOnViolation>
<!-- Skip entire check. -->
<skip>false</skip>
<!-- The lowest severity level that is considered a violation. -->
<violationSeverity>info</violationSeverity>
<!-- If you have some class to exclude use "exclude" node -->
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.3</version>
<configuration>
<!-- Max level of analisys and error reporting. -->
<effort>Max</effort>
<!-- Build should fail upon a violation. -->
<failOnError>true</failOnError>
<!-- Low level for threshold. -->
<threshold>Low</threshold>
</configuration>
<executions>
<!-- Ensures that FindBugs inspects source code when project is compiled. -->
<execution>
<id>analyze-compile</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>set-build-properties</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- It will first check to see if you have locally modified files,
and will fail if there are any. -->
<doCheck>true</doCheck>
<!-- If this is made true, then the revision will be updated to the
latest in the repo, otherwise it will remain what it is locally -->
<doUpdate>true</doUpdate>
<!-- This ensures that even if we are not connected to scm than also
take the version from local .svn file -->
<format>{0}</format>
<items>
<item>scmVersion</item>
</items>
<!-- If the plugin fails to get the scm revision, set it to "unavailable" -->
<revisionOnScmFailure>unavailable</revisionOnScmFailure>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- Update Manifest file (META-INF/MANIFEST.MF) with the new informations.
So this "transformation" will add the following lines: - Main-Class: THE
program entry point; - Implementation-Title: the title of the implementation;
- Implementation-Version: information retrieved from pom.xml (this file).
See project -> version node; - Implementation-Vendor: the vendor of the implementation;
- Scm-Revision: with git sha, "unavailable if it is impossible to retrieve. -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${project.mainClass}</Main-Class>
<Implementation-Title>${project.name}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>${project.vendor}</Implementation-Vendor>
<Scm-Revision>${buildNumber}</Scm-Revision>
</manifestEntries>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<!-- add support for ssh/scp -->
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.10</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>execute-test-commands</id>
<phase>deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<serverId>develop-server</serverId>
<!-- URL to upload final jar -->
<url>scp://example.com</url>
<!-- Input directory (local) -->
<fromDir>${project.build.outputDirectory}/../</fromDir>
<!-- File to upload -->
<includes>maven-example-project-for-java.jar</includes>
<!-- Output directory (server side) -->
<toDir>/bin</toDir>
<!--Jar is sent without compression over the net -->
<optimize>false</optimize>
<commands>
<!-- Remove from the server the oldest file -->
<command>\rm /bin/maven-example-project-for-java.jar</command>
</commands>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>