Skip to content

Commit a7c03cb

Browse files
committed
Add support for creating cli jar (currently only Digest)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/codec/trunk@1744720 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5a5bbc6 commit a7c03cb

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

pom.xml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,101 @@ limitations under the License.
252252
</plugins>
253253
</pluginManagement>
254254
<plugins>
255+
256+
<!-- Exclude cli from source jar -->
257+
<plugin>
258+
<groupId>org.apache.maven.plugins</groupId>
259+
<artifactId>maven-source-plugin</artifactId>
260+
<configuration>
261+
<excludes>
262+
<exclude>**/cli/**</exclude>
263+
</excludes>
264+
</configuration>
265+
</plugin>
266+
267+
<!-- Exclude cli from binary jar -->
268+
<plugin>
269+
<groupId>org.apache.maven.plugins</groupId>
270+
<artifactId>maven-jar-plugin</artifactId>
271+
<configuration>
272+
<excludes>
273+
<exclude>**/cli/**</exclude>
274+
</excludes>
275+
</configuration>
276+
</plugin>
277+
278+
<!-- Create CLI jar -->
279+
<plugin>
280+
<artifactId>maven-antrun-plugin</artifactId>
281+
<executions>
282+
<execution>
283+
<phase>package</phase>
284+
<configuration>
285+
<target>
286+
<!--
287+
Create the binary cli jar, which will be added to the binary zip/tgz,
288+
but not deployed independently to Maven
289+
-->
290+
<jar destfile="target/commons-codec-cli-${project.version}.jar">
291+
<metainf dir="${basedir}" includes="NOTICE.txt,LICENSE.txt" />
292+
<manifest>
293+
<attribute name="Extension-Name" value="org.apache.commons.net" />
294+
<attribute name="Specification-Title" value="${project.name}" />
295+
<attribute name="Implementation-Title" value="${project.name}" />
296+
<attribute name="Implementation-Vendor" value="${project.organization.name}" />
297+
<attribute name="Implementation-Version" value="${project.version}" />
298+
<attribute name="Implementation-Vendor-Id" value="org.apache" />
299+
<attribute name="Implementation-Build" value="${implementation.build}"/>
300+
<attribute name="X-Compile-Source-JDK" value="${maven.compiler.source}" />
301+
<attribute name="X-Compile-Target-JDK" value="${maven.compiler.target}" />
302+
<attribute name="Main-Class" value="org.apache.commons.codec.cli.Digest" />
303+
</manifest>
304+
<fileset dir="target/classes" includes="org/apache/commons/codec/cli/**"/>
305+
<fileset dir="target/classes" includes="org/apache/commons/codec/BinaryDecoder.class"/>
306+
<fileset dir="target/classes" includes="org/apache/commons/codec/BinaryEncoder.class"/>
307+
<fileset dir="target/classes" includes="org/apache/commons/codec/Charsets.class"/>
308+
<fileset dir="target/classes" includes="org/apache/commons/codec/Decoder.class"/>
309+
<fileset dir="target/classes" includes="org/apache/commons/codec/DecoderException.class"/>
310+
<fileset dir="target/classes" includes="org/apache/commons/codec/Encoder.class"/>
311+
<fileset dir="target/classes" includes="org/apache/commons/codec/EncoderException.class"/>
312+
<fileset dir="target/classes" includes="org/apache/commons/codec/binary/Hex.class"/>
313+
<fileset dir="target/classes" includes="org/apache/commons/codec/digest/DigestUtils.class"/>
314+
<fileset dir="target/classes" includes="org/apache/commons/codec/digest/MessageDigestAlgorithms.class"/>
315+
</jar>
316+
</target>
317+
</configuration>
318+
<goals>
319+
<goal>run</goal>
320+
</goals>
321+
</execution>
322+
</executions>
323+
</plugin>
324+
325+
<!-- Attaches the cli JAR to the Maven lifecycle
326+
to ensure it will be signed and deployed as normal -->
327+
<plugin>
328+
<groupId>org.codehaus.mojo</groupId>
329+
<artifactId>build-helper-maven-plugin</artifactId>
330+
<executions>
331+
<execution>
332+
<id>attach-artifacts</id>
333+
<phase>package</phase>
334+
<goals>
335+
<goal>attach-artifact</goal>
336+
</goals>
337+
<configuration>
338+
<artifacts>
339+
<artifact>
340+
<file>target/commons-codec-cli-${project.version}.jar</file>
341+
<type>jar</type>
342+
<classifier>cli</classifier>
343+
</artifact>
344+
</artifacts>
345+
</configuration>
346+
</execution>
347+
</executions>
348+
</plugin>
349+
255350
<plugin>
256351
<groupId>org.apache.maven.plugins</groupId>
257352
<artifactId>maven-surefire-plugin</artifactId>

0 commit comments

Comments
 (0)