Skip to content

Commit 378fcbd

Browse files
Alexandre Dutraolim7t
authored andcommitted
Introducing Maven license plugin (JAVA-704)
1 parent 0715c61 commit 378fcbd

8 files changed

Lines changed: 147 additions & 52 deletions

File tree

driver-core/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<description>A driver for Apache Cassandra 1.2+ that works exclusively with the Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol.</description>
2727
<url>https://github.com/datastax/java-driver</url>
2828

29+
<properties>
30+
<main.basedir>${project.parent.basedir}</main.basedir>
31+
</properties>
32+
2933
<dependencies>
3034
<dependency>
3135
<groupId>io.netty</groupId>

driver-dist/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
</parent>
2323
<artifactId>cassandra-driver-dist</artifactId>
2424

25+
<properties>
26+
<main.basedir>${project.parent.basedir}</main.basedir>
27+
</properties>
28+
2529
<!-- Should be pom but Javadoc generation requires a "classpath-capable" package -->
2630
<packaging>jar</packaging>
2731

driver-dse/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
<description>Extensions to the CQL driver for use with DataStax Enterprise.</description>
2727
<url>https://github.com/datastax/java-driver</url>
2828

29+
<properties>
30+
<main.basedir>${project.parent.basedir}</main.basedir>
31+
</properties>
32+
2933
<dependencies>
3034
<dependency>
3135
<groupId>com.datastax.cassandra</groupId>

driver-examples/osgi/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<properties>
2828
<felix.version>4.6.0</felix.version>
2929
<pax-exam.version>3.6.0</pax-exam.version>
30+
<main.basedir>${project.parent.parent.basedir}</main.basedir>
3031
</properties>
3132

3233
<dependencies>

driver-examples/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<description>A collection of examples to demonstrate DataStax Java Driver for Apache Cassandra.</description>
2525
<url>https://github.com/datastax/java-driver</url>
2626

27+
<properties>
28+
<main.basedir>${project.parent.basedir}</main.basedir>
29+
</properties>
30+
2731
<modules>
2832
<module>stress</module>
2933
<module>osgi</module>

driver-examples/stress/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
<description>A stress test example for DataStax Java Driver for Apache Cassandra.</description>
2525
<url>https://github.com/datastax/java-driver</url>
2626

27+
<properties>
28+
<main.basedir>${project.parent.parent.basedir}</main.basedir>
29+
</properties>
30+
2731
<dependencies>
2832
<dependency>
2933
<groupId>com.datastax.cassandra</groupId>

pom.xml

Lines changed: 113 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
<groupId>org.sonatype.oss</groupId>
1818
<artifactId>oss-parent</artifactId>
1919
<version>7</version>
20-
<relativePath />
20+
<relativePath/>
2121
</parent>
22-
22+
2323
<groupId>com.datastax.cassandra</groupId>
2424
<artifactId>cassandra-driver-parent</artifactId>
2525
<version>2.0.10-SNAPSHOT</version>
2626
<packaging>pom</packaging>
2727
<name>DataStax Java Driver for Apache Cassandra</name>
2828
<description>A driver for Apache Cassandra 1.2+ that works exclusively with the Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol.</description>
2929
<url>https://github.com/datastax/java-driver</url>
30+
<inceptionYear>2012</inceptionYear>
3031

3132
<modules>
3233
<module>driver-core</module>
@@ -59,6 +60,7 @@
5960
our build is still using JDK 6.
6061
-->
6162
<scassandra.version>0.4.1</scassandra.version>
63+
<main.basedir>${project.basedir}</main.basedir>
6264
</properties>
6365

6466
<dependencies>
@@ -95,63 +97,122 @@
9597
<artifactId>maven-compiler-plugin</artifactId>
9698
<version>3.1</version>
9799
<configuration>
98-
<source>${java.version}</source>
99-
<target>${java.version}</target>
100-
<optimize>true</optimize>
101-
<showDeprecation>true</showDeprecation>
102-
<showWarnings>true</showWarnings>
100+
<source>${java.version}</source>
101+
<target>${java.version}</target>
102+
<optimize>true</optimize>
103+
<showDeprecation>true</showDeprecation>
104+
<showWarnings>true</showWarnings>
105+
</configuration>
106+
</plugin>
107+
<plugin>
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-source-plugin</artifactId>
110+
<version>2.2.1</version>
111+
<executions>
112+
<execution>
113+
<id>attach-sources</id>
114+
<goals>
115+
<goal>jar</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
<plugin>
121+
<groupId>org.apache.maven.plugins</groupId>
122+
<artifactId>maven-javadoc-plugin</artifactId>
123+
<version>2.9.1</version>
124+
<configuration>
125+
<!-- I can haz math in my javadoc (see http://zverovich.net/2012/01/14/beautiful-math-in-javadoc.html) -->
126+
<additionalparam>-header '&lt;script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;&lt;/script&gt;'</additionalparam>
127+
</configuration>
128+
<executions>
129+
<execution>
130+
<id>attach-javadocs</id>
131+
<goals>
132+
<goal>jar</goal>
133+
</goals>
134+
<configuration>
135+
<additionalparam>${javadoc.opts}</additionalparam>
136+
</configuration>
137+
</execution>
138+
</executions>
139+
</plugin>
140+
<plugin>
141+
<artifactId>maven-assembly-plugin</artifactId>
142+
<version>2.4</version>
143+
<configuration>
144+
<descriptorRefs>
145+
<descriptorRef>jar-with-dependencies</descriptorRef>
146+
</descriptorRefs>
103147
</configuration>
104148
</plugin>
105149
<plugin>
106-
<groupId>org.apache.maven.plugins</groupId>
107-
<artifactId>maven-source-plugin</artifactId>
108-
<version>2.2.1</version>
109-
<executions>
110-
<execution>
111-
<id>attach-sources</id>
112-
<goals>
113-
<goal>jar</goal>
114-
</goals>
115-
</execution>
116-
</executions>
150+
<groupId>org.apache.maven.plugins</groupId>
151+
<artifactId>maven-release-plugin</artifactId>
152+
<version>2.5</version>
153+
<configuration>
154+
<tagNameFormat>@{project.version}</tagNameFormat>
155+
</configuration>
117156
</plugin>
118157
<plugin>
119-
<groupId>org.apache.maven.plugins</groupId>
120-
<artifactId>maven-javadoc-plugin</artifactId>
121-
<version>2.9.1</version>
122-
<configuration>
123-
<!-- I can haz math in my javadoc (see http://zverovich.net/2012/01/14/beautiful-math-in-javadoc.html) -->
124-
<additionalparam>-header '&lt;script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"&gt;&lt;/script&gt;'</additionalparam>
125-
</configuration>
126-
<executions>
127-
<execution>
128-
<id>attach-javadocs</id>
129-
<goals>
130-
<goal>jar</goal>
131-
</goals>
132-
<configuration>
133-
<additionalparam>${javadoc.opts}</additionalparam>
134-
</configuration>
135-
</execution>
136-
</executions>
158+
<groupId>org.codehaus.mojo</groupId>
159+
<artifactId>build-helper-maven-plugin</artifactId>
160+
<version>1.9.1</version>
161+
<executions>
162+
<execution>
163+
<id>timestamp-property</id>
164+
<phase>initialize</phase>
165+
<goals>
166+
<goal>timestamp-property</goal>
167+
</goals>
168+
<configuration>
169+
<name>currentYear</name>
170+
<pattern>yyyy</pattern>
171+
<locale>en_US</locale>
172+
</configuration>
173+
</execution>
174+
</executions>
137175
</plugin>
176+
<!--
177+
To update license headers run:
178+
mvn license:format -DcurrentYear=XXXX
179+
-->
138180
<plugin>
139-
<artifactId>maven-assembly-plugin</artifactId>
140-
<version>2.4</version>
141-
<configuration>
142-
<descriptorRefs>
143-
<descriptorRef>jar-with-dependencies</descriptorRef>
144-
</descriptorRefs>
145-
</configuration>
146-
</plugin>
147-
<plugin>
148-
<groupId>org.apache.maven.plugins</groupId>
149-
<artifactId>maven-release-plugin</artifactId>
150-
<version>2.5</version>
151-
<configuration>
152-
<tagNameFormat>@{project.version}</tagNameFormat>
153-
</configuration>
154-
</plugin>
181+
<groupId>com.mycila</groupId>
182+
<artifactId>license-maven-plugin</artifactId>
183+
<version>2.8</version>
184+
<configuration>
185+
<header>${main.basedir}/src/license/header.txt</header>
186+
<includes>
187+
<include>src/**/*.java</include>
188+
<include>src/**/*.xml</include>
189+
<include>src/**/*.properties</include>
190+
<include>**/pom.xml</include>
191+
</includes>
192+
<excludes>
193+
<exclude>**/src/main/config/ide/**</exclude>
194+
</excludes>
195+
<mapping>
196+
<java>SLASHSTAR_STYLE</java>
197+
<properties>SCRIPT_STYLE</properties>
198+
</mapping>
199+
<strictCheck>true</strictCheck>
200+
</configuration>
201+
<executions>
202+
<execution>
203+
<id>check-license</id>
204+
<phase>initialize</phase>
205+
<goals>
206+
<goal>check</goal>
207+
</goals>
208+
<configuration>
209+
<properties>
210+
<currentYear>${currentYear}</currentYear>
211+
</properties>
212+
</configuration>
213+
</execution>
214+
</executions>
215+
</plugin>
155216
</plugins>
156217
</build>
157218

src/license/header.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright (C) ${project.inceptionYear}-${currentYear} DataStax Inc.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

0 commit comments

Comments
 (0)