From: <jo...@us...> - 2004-11-19 13:38:13
|
joehni 04/11/19 05:38:06 Modified: javaapp plugin.jelly project.xml Added: javaapp/src/plugin-test .cvsignore maven.xml project.xml javaapp/src/plugin-test/src/main/demo Manifest.java Log: Fix manifest. Added test case for uberjar.bundle suppoert. Added test case for working manifest entries in Java. Fix my developer id. Revision Changes Path 1.10 +11 -7 maven-plugins/javaapp/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/javaapp/plugin.jelly,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- plugin.jelly 18 Nov 2004 15:33:47 -0000 1.9 +++ plugin.jelly 19 Nov 2004 13:38:05 -0000 1.10 @@ -191,18 +191,22 @@ <j:set var="specificationVersion" value="${maven.javaapp.manifest.specificationVersion}" /> <j:if test="${empty(specificationVersion)}"> - <j:set var="versionIdx" value="${pom.version.indexOf('.')}" /> - <j:set var="versionIdx" value="${pom.version.indexOf('.', versionIdx+1)}" /> - <j:set var="specificationVersion" value="${pom.version.substring(0,versionIdx)}" /> + <u:tokenize var="versionItems" delim="." trim="true">${pom.currentVersion}</u:tokenize> + <j:if test="${size(versionItems) > 0}"> + <j:set var="specificationVersion" value="${versionItems[0]}" /> + </j:if> + <j:if test="${size(versionItems) > 1}"> + <j:set var="specificationVersion" value="${specificationVersion}.${versionItems[1]}" /> + </j:if> </j:if> <u:replace var="packagePath" oldChar="." newChar="/" value="${pom.package}"/> <ant:section name="${packagePath}/"> - <ant:attribute name="Specification-Title" value="${maven.javaapp.manifest.specificationTile}"/> + <ant:attribute name="Specification-Title" value="${maven.javaapp.manifest.specificationTitle}"/> <ant:attribute name="Specification-Vendor" value="${maven.javaapp.manifest.specificationVendor}"/> <ant:attribute name="Specification-Version" value="${specificationVersion}"/> - <ant:attribute name="Package-Title" value="${pom.package}"/> - <ant:attribute name="Package-Vendor" value="${pom.organization.name}"/> - <ant:attribute name="Package-Version" value="${pom.currentVersion}"/> + <ant:attribute name="Implementation-Title" value="${pom.package}"/> + <ant:attribute name="Implementation-Vendor" value="${pom.organization.name}"/> + <ant:attribute name="Implementation-Version" value="${pom.currentVersion}"/> </ant:section> <j:if test="${context.getVariable('maven.jar.manifest.groups.list') != null}"> 1.13 +1 -1 maven-plugins/javaapp/project.xml Index: project.xml =================================================================== RCS file: /cvsroot/maven-plugins/maven-plugins/javaapp/project.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- project.xml 17 Nov 2004 16:27:35 -0000 1.12 +++ project.xml 19 Nov 2004 13:38:05 -0000 1.13 @@ -43,7 +43,7 @@ </developer> <developer> <name>Jörg Schaible</name> - <id>wdsgoe</id> + <id>joehni</id> <email>joe...@gm...</email> <organization>Elsag-Solutions AG</organization> <roles> 1.1 maven-plugins/javaapp/src/plugin-test/.cvsignore Index: .cvsignore =================================================================== *.log 1.1 maven-plugins/javaapp/src/plugin-test/maven.xml Index: maven.xml =================================================================== <!-- /* * 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:j="jelly:core" xmlns:u="jelly:util" xmlns:artifact="artifact" xmlns:assert="assert"> <goal name="testPlugin" prereqs="clean,test-javaapp"> <attainGoal name="clean"/> </goal> <goal name="test-javaapp" prereqs="javaapp:jar"> <!-- test license collection works --> <assert:assertFileExists file="${maven.build.dir}/javaapp/META-INF/commons-lang-2.0.jar-LICENSE.txt"/> <!-- check that an exclude with uberjar.bundle works --> <assert:assertFileNotFound file="${maven.build.dir}/commons-logging-1.0.3.jar"/> <assert:assertFileNotFound file="${maven.build.dir}/javaapp/META-INF/commons-logging-1.0.4.jar-LICENSE.txt"/> <java classname="demo.Manifest" fork="yes" failonerror="true"> <!-- sysproperty key="basedir" value="${basedir}"/ --> <classpath> <pathelement location="${maven.javaapp.final.name}"/> </classpath> </java> </goal> </project> 1.1 maven-plugins/javaapp/src/plugin-test/project.xml Index: project.xml =================================================================== <?xml version="1.0" encoding="ISO-8859-1"?> <!-- /* * 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> <name>Test project for the javaapp plugin</name> <groupId>test</groupId> <id>test-maven-javaapp-plugin</id> <currentVersion>1.0.1a</currentVersion> <organization> <name>SourceForge</name> <url>http://maven-plugins.sf.net</url> </organization> <inceptionYear>2004</inceptionYear> <package>demo</package> <shortDescription>Demo Package</shortDescription> <description>Demo Package Description</description> <url/> <issueTrackingUrl/> <siteAddress/> <siteDirectory/> <distributionDirectory/> <repository/> <versions/> <mailingLists/> <developers> <developer> <name>Jörg Schaible</name> <id>joehni</id> <email>joe...@gm...</email> <organization>Elsag-Solutions AG</organization> <roles> <role>Java Developer</role> </roles> <timezone>+1</timezone> </developer> </developers> <dependencies> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.0.4</version> <url>http://jakarta.apache.org/commons/logging.html</url> <properties> <uberjar.bundle>false</uberjar.bundle> </properties> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.0</version> <url>http://jakarta.apache.org/commons/lang.html</url> </dependency> </dependencies> <build> <sourceDirectory>${basedir}/src/main</sourceDirectory> </build> </project> 1.1 maven-plugins/javaapp/src/plugin-test/src/main/demo/Manifest.java Index: Manifest.java =================================================================== /* * 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. */ package demo; /** * Manifest tester class. * Poor man's unit test. * @author Jörg Schaible */ public class Manifest { private static void ass(String text, boolean b) { if (!b) { System.err.println("ERROR: " + text); System.exit(-1); } } private static void ass(String text, String expect, String receive) { if (!expect.equals(receive)) { System.err.println( "ERROR: " + text + "'" + expect + "' is not " + receive); System.exit(-1); } } public static void main(String[] args) { String value; Package pkg = Manifest.class.getPackage(); ass("Package not null", pkg != null); value = pkg.getSpecificationTitle(); ass("Specification title", "test:test-maven-javaapp-plugin", value); value = pkg.getSpecificationVersion(); ass("Specification version", "1.0", value); value = pkg.getSpecificationVendor(); ass("Specification vendor", "SourceForge", value); value = pkg.getImplementationTitle(); ass("Implementation title", "demo", value); value = pkg.getImplementationVersion(); ass("Implementation version", "1.0.1a", value); value = pkg.getImplementationVendor(); ass("Implementation vendor", "SourceForge", value); } } |