|
9 | 9 | <artifactId>net.sf.eclipsecs.checkstyle</artifactId>
|
10 | 10 | <packaging>eclipse-plugin</packaging>
|
11 | 11 | <name>Checkstyle Core Library Plugin</name>
|
12 |
| - |
| 12 | + |
13 | 13 | <properties>
|
14 | 14 | <checkstyle.version>8.35</checkstyle.version>
|
| 15 | + <!-- -Dcheckstyle.downloadFile=checkstyle-8.36.zip --> |
| 16 | + <checkstyle.downloadFile>checkstyle-${checkstyle.version}.zip</checkstyle.downloadFile> |
| 17 | + <checkstyle.srcUrl>https://github.com/checkstyle/checkstyle/archive/${checkstyle.downloadFile}</checkstyle.srcUrl> |
15 | 18 | </properties>
|
| 19 | + <dependencies> |
| 20 | + <dependency> |
| 21 | + <groupId>com.puppycrawl.tools</groupId> |
| 22 | + <artifactId>checkstyle</artifactId> |
| 23 | + <version>${checkstyle.version}</version> |
| 24 | + </dependency> |
| 25 | + </dependencies> |
16 | 26 | <build>
|
17 | 27 | <plugins>
|
18 |
| - <plugin> |
19 |
| - <groupId>com.googlecode.maven-download-plugin</groupId> |
20 |
| - <artifactId>download-maven-plugin</artifactId> |
21 |
| - <executions> |
22 |
| - <execution> |
23 |
| - <id>download-checkstyle-src</id> |
24 |
| - <phase>initialize</phase> |
25 |
| - <goals> |
26 |
| - <goal>wget</goal> |
27 |
| - </goals> |
28 |
| - <configuration> |
29 |
| - <outputDirectory>.</outputDirectory> |
30 |
| - <url>https://github.com/checkstyle/checkstyle/archive/checkstyle-${checkstyle.version}.zip</url> |
31 |
| - <outputFileName>checkstyle-checkstyle-${checkstyle.version}.zip</outputFileName> |
32 |
| - </configuration> |
33 |
| - </execution> |
34 |
| - </executions> |
35 |
| - </plugin> |
36 | 28 | <plugin>
|
37 | 29 | <artifactId>maven-antrun-plugin</artifactId>
|
38 | 30 | <executions>
|
39 | 31 | <execution>
|
40 | 32 | <phase>prepare-package</phase>
|
| 33 | + <id>unpack-checkstyle-src</id> |
41 | 34 | <configuration>
|
42 | 35 | <target>
|
43 | 36 | <delete dir="${project.build.directory}/checkstyle-src-unpack" />
|
44 | 37 | <delete dir="${project.build.directory}/checkstyle-src" />
|
45 |
| - <first id="cssrc"> |
46 |
| - <fileset dir="." includes="checkstyle-checkstyle-*.zip" /> |
47 |
| - </first> |
48 |
| - <unzip src="${toString:cssrc}" dest="${project.build.directory}/checkstyle-src-unpack"> |
| 38 | + <unzip src="${basedir}/checkstyle-${checkstyle.downloadFile}" |
| 39 | + dest="${project.build.directory}/checkstyle-src-unpack"> |
49 | 40 | <patternset>
|
50 | 41 | <include name="**/src/main/java/**" />
|
51 | 42 | <include name="**/src/main/resources/**" />
|
|
87 | 78 | </plugin>
|
88 | 79 | </plugins>
|
89 | 80 | </build>
|
| 81 | + |
| 82 | + <profiles> |
| 83 | + <profile> |
| 84 | + <id>download-checkstyle-src</id> |
| 85 | + <activation> |
| 86 | + <file> |
| 87 | + <missing>${basedir}/checkstyle-checkstyle-8.35.zip</missing><!-- change this when checkstyle.version changed --> |
| 88 | + </file> |
| 89 | + </activation> |
| 90 | + <build> |
| 91 | + <plugins> |
| 92 | + <plugin> |
| 93 | + <groupId>com.googlecode.maven-download-plugin</groupId> |
| 94 | + <artifactId>download-maven-plugin</artifactId> |
| 95 | + <executions> |
| 96 | + <execution> |
| 97 | + <id>download-checkstyle-src</id> |
| 98 | + <phase>initialize</phase> |
| 99 | + <goals> |
| 100 | + <goal>wget</goal> |
| 101 | + </goals> |
| 102 | + <configuration> |
| 103 | + <outputDirectory>.</outputDirectory> |
| 104 | + <url>${checkstyle.srcUrl}</url> |
| 105 | + <outputFileName>checkstyle-${checkstyle.downloadFile}</outputFileName> |
| 106 | + </configuration> |
| 107 | + </execution> |
| 108 | + </executions> |
| 109 | + </plugin> |
| 110 | + </plugins> |
| 111 | + </build> |
| 112 | + </profile> |
| 113 | + <profile> |
| 114 | + <id>pack-fat-checkstyle</id> |
| 115 | + <activation> |
| 116 | + <file> |
| 117 | + <missing>${basedir}/checkstyle-all-8.35.jar</missing><!-- change this when checkstyle.version changed --> |
| 118 | + </file> |
| 119 | + </activation> |
| 120 | + <build> |
| 121 | + <plugins> |
| 122 | + <plugin> |
| 123 | + <groupId>org.apache.maven.plugins</groupId> |
| 124 | + <artifactId>maven-dependency-plugin</artifactId> |
| 125 | + <version>3.1.2</version> |
| 126 | + <executions> |
| 127 | + <execution> |
| 128 | + <id>unpack</id> |
| 129 | + <phase>initialize</phase> |
| 130 | + <goals> |
| 131 | + <goal>unpack</goal> |
| 132 | + </goals> |
| 133 | + <configuration> |
| 134 | + <artifactItems> |
| 135 | + <artifactItem> |
| 136 | + <groupId>com.puppycrawl.tools</groupId> |
| 137 | + <artifactId>checkstyle</artifactId> |
| 138 | + <version>${checkstyle.version}</version> |
| 139 | + <outputDirectory>${project.build.directory}</outputDirectory> |
| 140 | + <includes>META-INF/MANIFEST.MF</includes> |
| 141 | + </artifactItem> |
| 142 | + </artifactItems> |
| 143 | + </configuration> |
| 144 | + </execution> |
| 145 | + </executions> |
| 146 | + </plugin> |
| 147 | + <plugin> |
| 148 | + <groupId>org.apache.maven.plugins</groupId> |
| 149 | + <artifactId>maven-assembly-plugin</artifactId> |
| 150 | + <version>3.3.0</version> |
| 151 | + <configuration> |
| 152 | + <descriptorRefs> |
| 153 | + <descriptorRef>jar-with-dependencies</descriptorRef> |
| 154 | + </descriptorRefs> |
| 155 | + <outputDirectory>${basedir}</outputDirectory> |
| 156 | + <finalName>checkstyle-all-${checkstyle.version}</finalName> |
| 157 | + <appendAssemblyId>false</appendAssemblyId> |
| 158 | + <formats> |
| 159 | + <format>jar</format> |
| 160 | + </formats> |
| 161 | + <overrideGroupName>com.puppycrawl.tools</overrideGroupName> |
| 162 | + <archive> |
| 163 | + <manifestFile>${project.build.directory}/META-INF/MANIFEST.MF</manifestFile> |
| 164 | + </archive> |
| 165 | + </configuration> |
| 166 | + <executions> |
| 167 | + <execution> |
| 168 | + <id>make-assembly</id> |
| 169 | + <phase>initialize</phase> |
| 170 | + <goals> |
| 171 | + <goal>single</goal> |
| 172 | + </goals> |
| 173 | + </execution> |
| 174 | + </executions> |
| 175 | + </plugin> |
| 176 | + <plugin> |
| 177 | + <artifactId>maven-antrun-plugin</artifactId> |
| 178 | + <executions> |
| 179 | + <execution> |
| 180 | + <phase>generate-sources</phase> |
| 181 | + <id>copy-heckstyle-all-jar</id> |
| 182 | + <configuration> |
| 183 | + <target> |
| 184 | + <delete file="${basedir}/checkstyle-all.jar" failonerror="false" /> |
| 185 | + <copy file="${basedir}/checkstyle-all-${checkstyle.version}.jar" |
| 186 | + tofile="${basedir}/checkstyle-all.jar" overwrite="true" /> |
| 187 | + </target> |
| 188 | + </configuration> |
| 189 | + <goals> |
| 190 | + <goal>run</goal> |
| 191 | + </goals> |
| 192 | + </execution> |
| 193 | + </executions> |
| 194 | + </plugin> |
| 195 | + </plugins> |
| 196 | + </build> |
| 197 | + </profile> |
| 198 | + </profiles> |
90 | 199 | </project>
|
0 commit comments