MPJAR-32. Allow jars to include source code.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion committed 2004-07-12 06:58:01 +00:00
1 parent 032e8309f3
commit d5c48c1a74
9 files changed
+174 -7

No files matched your search

+18 -1
View File
@@ -63,7 +63,11 @@
<ant:fail>You must define currentVersion in your POM.</ant:fail>
</j:when>
</j:choose>
<j:if test="${maven.jar.include.source}">
<attainGoal name="jar:copy-source"/>
</j:if>
<ant:available property="maven.jar.manifest.available"
file="${maven.jar.manifest}"/>
@@ -269,4 +273,17 @@
project="${pom}"
/>
</goal>
<!-- ================================================================== -->
<!-- C O P Y S O U R C E -->
<!-- ================================================================== -->
<goal name="jar:copy-source" description="Copy source code for inclusion in the jar">
<util:available file="${pom.build.sourceDirectory}">
<ant:mkdir dir="${maven.build.dest}/${maven.jar.source.path}"/>
<ant:copy todir="${maven.build.dest}/${maven.jar.source.path}">
<ant:fileset dir="${pom.build.sourceDirectory}"/>
</ant:copy>
</util:available>
</goal>
</project>
+2
View File
@@ -24,3 +24,5 @@ maven.jar.manifest.extensions.add=false
maven.jar.excludes = **/package.html
maven.jar.index=false
maven.jar.compress=true
maven.jar.include.source=false
maven.jar.source.path=src
+1 -1
View File
@@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-jar-plugin</id>
<name>Maven Jar Plug-in</name>
<currentVersion>1.6</currentVersion>
<currentVersion>1.6.1-SNAPSHOT</currentVersion>
<description>Plugin for creating JAR files. Requires Maven 1.0 RC2.</description>
<shortDescription>Create jar files</shortDescription>
<url>http://maven.apache.org/reference/plugins/jar/</url>
+2
View File
@@ -0,0 +1,2 @@
gump.xml
*.log
+63
View File
@@ -0,0 +1,63 @@
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:util="jelly:util"
xmlns:assert="assert"
xmlns:j="jelly:core">
<goal name="testPlugin" prereqs="test-jar">
<attainGoal name="clean"/>
</goal>
<goal name="test-jar"
prereqs="test-jar-created,test-jar-with-source,test-jar-without-source,test-jar-with-custom-source">
<j:set var="finalJar" value="${maven.build.dir}/${maven.final.name}.jar"/>
</goal>
<goal name="test-jar-created">
<attainGoal name="clean"/>
<attainGoal name="jar"/>
<j:set var="finalJar" value="${maven.build.dir}/${maven.final.name}.jar"/>
<assert:assertFileExists file="${finalJar}"/>
</goal>
<goal name="test-jar-with-source">
<j:set var="maven.jar.include.source" value="true"/>
<attainGoal name="test-jar-created"/>
<!-- unzip the jar and check for the source -->
<unzip src="${finalJar}" dest="${maven.build.dir}/jar-test"/>
<assert:assertFileExists file="${maven.build.dir}/jar-test/src/org/apache/maven/Dummy.java"/>
</goal>
<goal name="test-jar-without-source">
<j:set var="maven.jar.include.source" value="false"/>
<attainGoal name="test-jar-created"/>
<!-- unzip the jar and check for the source -->
<unzip src="${finalJar}" dest="${maven.build.dir}/jar-test"/>
<assert:assertFileNotFound file="${maven.build.dir}/jar-test/src/org/apache/maven/Dummy.java"/>
</goal>
<goal name="test-jar-with-custom-source">
<j:set var="maven.jar.include.source" value="true"/>
<j:set var="maven.jar.source.path" value="sourceDir"/>
<attainGoal name="test-jar-created"/>
<!-- unzip the jar and check for the source -->
<unzip src="${finalJar}" dest="${maven.build.dir}/jar-test"/>
<assert:assertFileExists file="${maven.build.dir}/jar-test/sourceDir/org/apache/maven/Dummy.java"/>
</goal>
</project>
+58
View File
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-jar-plugin</id>
<name>Test project for Maven Jar Plugin</name>
<groupId>maven</groupId>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/jakarta-logo-blue.gif</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.jpg</logo>
<description>Test for Maven Jar plugin</description>
<shortDescription>Test for Maven Jar plugin</shortDescription>
<url>http://maven.apache.org/reference/plugins/jar/</url>
<siteDirectory>/www/maven.apache.org/reference/plugins/jar/</siteDirectory>
<repository>
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven/src/plugins-build/jar/</connection>
<url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/jar/</url>
</repository>
<developers>
<developer>
<name>dIon Gillard</name>
<id>dion</id>
<email>dion@multitask.com.au</email>
<organization>Multitask Consulting</organization>
<roles>
<role>Documentation</role>
</roles>
</developer>
</developers>
<build>
<sourceDirectory>src/main</sourceDirectory>
</build>
</project>
@@ -0,0 +1,6 @@
package org.apache.maven;
public class Dummy
{
public String badChecky = "error";
}
+3
View File
@@ -25,6 +25,9 @@
<author email="dion@apache.org">dIon Gillard</author>
</properties>
<body>
<release version="1.6.1" date="in CVS">
<action dev="dion" type="add">Add the ability to create source jars</action>
</release>
<release version="1.6" date="2004-06-28">
<action dev="brett" type="update">Use the artifact plugin for installation</action>
<action dev="evenisse" type="fix" due-to="Martin van den Bemt" issue="MPJAR-29">Replace Apache Jakarta Maven by Apache Maven in Manifest</action>
+21 -5
View File
@@ -62,6 +62,14 @@
The default value is <code>null</code>
</td>
</tr>
<tr>
<td>maven.jar.include.source</td>
<td>Yes</td>
<td>
Whether the source should be included in the jar.
The default value is <code>false</code>
</td>
</tr>
<tr>
<td>maven.jar.index</td>
<td>Yes</td>
@@ -131,11 +139,19 @@
project descriptor</a>
</td>
</tr>
<tr>
<td>maven.jar.compress</td>
<td>Yes</td>
<td>Not only store data but also compress them, defaults to true.</td>
</tr>
<tr>
<td>maven.jar.compress</td>
<td>Yes</td>
<td>Not only store data but also compress them, defaults to true.</td>
</tr>
<tr>
<td>maven.jar.source.path</td>
<td>Yes</td>
<td>
The location of the source code within the jar, if included.
The default value is <code>src</code>
</td>
</tr>
</table>
</section>
<section name="Deploy Settings">