[pkg-java] r8705 - in trunk/maven-ant-helper: . bootstrap bootstrap/META-INF bootstrap/META-INF/plexus debian src/main/java

Ludovic Claude ludovicc-guest at alioth.debian.org
Wed Jul 1 14:43:30 UTC 2009


Author: ludovicc-guest
Date: 2009-07-01 14:43:30 +0000 (Wed, 01 Jul 2009)
New Revision: 8705

Added:
   trunk/maven-ant-helper/bootstrap/
   trunk/maven-ant-helper/bootstrap/META-INF/
   trunk/maven-ant-helper/bootstrap/META-INF/plexus/
   trunk/maven-ant-helper/bootstrap/META-INF/plexus/components.xml
   trunk/maven-ant-helper/manifest.mf
Modified:
   trunk/maven-ant-helper/debian/changelog
   trunk/maven-ant-helper/debian/control
   trunk/maven-ant-helper/debian/rules
   trunk/maven-ant-helper/maven-build.xml
   trunk/maven-ant-helper/maven-defaults.properties
   trunk/maven-ant-helper/src/main/java/ModelloTask.java
Log:
* maven-ant-helper version 5

Added: trunk/maven-ant-helper/bootstrap/META-INF/plexus/components.xml
===================================================================
--- trunk/maven-ant-helper/bootstrap/META-INF/plexus/components.xml	                        (rev 0)
+++ trunk/maven-ant-helper/bootstrap/META-INF/plexus/components.xml	2009-07-01 14:43:30 UTC (rev 8705)
@@ -0,0 +1,414 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you 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.
+-->
+
+<!-- Minimum version of the Maven components used only for bootstraping
+  the Maven build -->
+
+<component-set>
+  <components>
+    <component>
+      <role>org.apache.maven.plugin.PluginManager</role>
+      <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.project.path.PathTranslator</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.plugin.MavenPluginCollector</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.plugin.version.PluginVersionManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.plugin.PluginMappingManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.execution.RuntimeInformation</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.project.MavenProjectBuilder</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>org.apache.maven.extension.ExtensionManager</role>
+      <implementation>org.apache.maven.extension.DefaultExtensionManager</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.resolver.ArtifactResolver</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>org.apache.maven.plugin.PluginMappingManager</role>
+      <implementation>org.apache.maven.plugin.DefaultPluginMappingManager</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.repository.metadata.RepositoryMetadataManager</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <!-- Duplicated from Maven core as it is used in the plugin manager -->
+    <component>
+      <role>org.apache.maven.project.path.PathTranslator</role>
+      <implementation>org.apache.maven.project.path.DefaultPathTranslator</implementation>
+    </component>
+    <!--
+     |
+     |
+     |
+     -->
+    <component>
+      <role>org.apache.maven.Maven</role>
+      <implementation>org.apache.maven.DefaultMaven</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.project.MavenProjectBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.lifecycle.LifecycleExecutor</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.usability.diagnostics.ErrorDiagnostics</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.execution.RuntimeInformation</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>org.apache.maven.execution.RuntimeInformation</role>
+      <implementation>org.apache.maven.execution.DefaultRuntimeInformation</implementation>
+    </component>
+    <!--
+    |
+    |MojoExecutionExceptionDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>MojoExecutionExceptionDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.MojoExecutionExceptionDiagnoser</implementation>
+    </component>
+    <!--
+    |
+    |MojoFailureExceptionDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>MojoFailureExceptionDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.MojoFailureExceptionDiagnoser</implementation>
+    </component>
+    <!--
+    |
+    |ProjectBuildDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>ProjectBuildDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.ProjectBuildDiagnoser</implementation>
+    </component>
+    <!--
+    |
+    |ProfileActivationDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>ProfileActivationDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.ProfileActivationDiagnoser</implementation>
+    </component>
+    <!--
+    |
+    |PluginConfigurationDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>PluginConfigurationDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.PluginConfigurationDiagnoser</implementation>
+    </component>
+    <!--
+    |
+    |ArtifactNotFoundDiagnoser
+    |
+    -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>ArtifactNotFoundDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.ArtifactNotFoundDiagnoser</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
+        </requirement>
+      </requirements>
+    </component>
+    <!--
+     |
+     |ArtifactResolverDiagnoser
+     |
+     -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>ArtifactResolverDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.ArtifactResolverDiagnoser</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.manager.WagonManager</role>
+        </requirement>
+      </requirements>
+    </component>
+    <!--
+     |
+     |InvalidArtifactDiagnoser
+     |
+     -->
+    <component>
+      <role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
+      <role-hint>InvalidArtifactDiagnoser</role-hint>
+      <implementation>org.apache.maven.usability.InvalidArtifactDiagnoser</implementation>
+    </component>
+
+    <component>
+      <role>org.apache.maven.ConfigurationInterpolator</role>
+      <implementation>org.apache.maven.ReflectionConfigurationInterpolator</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.project.path.PathTranslator</role>
+        </requirement>
+      </requirements>
+    </component>
+    
+    <!--
+     |
+     | Lifecycle executor
+     |
+     -->
+    <component>
+      <role>org.apache.maven.lifecycle.LifecycleExecutor</role>
+      <implementation>org.apache.maven.lifecycle.DefaultLifecycleExecutor</implementation>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.plugin.PluginManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.extension.ExtensionManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.handler.manager.ArtifactHandlerManager</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.project.MavenProjectBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.project.interpolation.ModelInterpolator</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.ConfigurationInterpolator</role>
+        </requirement>
+      </requirements>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <!-- START SNIPPET: lifecycle -->
+            <phases>
+              <phase>validate</phase>
+              <phase>initialize</phase>
+              <phase>generate-sources</phase>
+              <phase>process-sources</phase>
+              <phase>generate-resources</phase>
+              <phase>process-resources</phase>
+              <phase>compile</phase>
+              <phase>process-classes</phase>
+              <phase>generate-test-sources</phase>
+              <phase>process-test-sources</phase>
+              <phase>generate-test-resources</phase>
+              <phase>process-test-resources</phase>
+              <phase>test-compile</phase>
+              <phase>process-test-classes</phase>
+              <phase>test</phase>
+              <phase>prepare-package</phase>
+              <phase>package</phase>
+              <phase>pre-integration-test</phase>
+              <phase>integration-test</phase>
+              <phase>post-integration-test</phase>
+              <phase>verify</phase>
+              <phase>install</phase>
+              <phase>deploy</phase>
+            </phases>
+            <!-- END SNIPPET: lifecycle -->
+          </lifecycle>
+          <lifecycle>
+            <id>clean</id>
+            <phases>
+              <phase>pre-clean</phase>
+              <phase>clean</phase>
+              <phase>post-clean</phase>
+            </phases>
+            <default-phases>
+              <clean>org.apache.maven.plugins:maven-clean-plugin:clean</clean>
+            </default-phases>
+          </lifecycle>
+        </lifecycles>
+        <!-- START SNIPPET: default-reports -->
+        <defaultReports>
+        </defaultReports>
+        <!-- END SNIPPET: default-reports -->
+        <!-- START SNIPPET: default-lifecycle -->
+        <!-- NOT USED, ACCORDING TO CODE.
+        <defaultPhases>
+          <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+          <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+          <process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
+          <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+          <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
+          <package>
+            org.apache.maven.plugins:maven-jar-plugin:jar,
+            org.apache.maven.plugins:maven-source-plugin:jar
+          </package>
+          <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+          <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
+        </defaultPhases>
+        -->
+        <!-- END SNIPPET: default-lifecycle -->
+      </configuration>
+    </component>
+
+    <!-- TODO: issues with the lifecycle:
+     - manually configured lifecycles will not pick up any later additions to the defaults where they are intended to extend defaults (have configuration <includeDefaults/> ?)
+     -->
+    <component>
+      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role-hint>pom</role-hint>
+      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <!-- START SNIPPET: pom-lifecycle -->
+            <phases>
+              <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+              <deploy></deploy>
+            </phases>
+            <optional-mojos>
+            </optional-mojos>
+            <!-- END SNIPPET: pom-lifecycle -->
+          </lifecycle>
+        </lifecycles>
+      </configuration>
+    </component>
+
+    <component>
+      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role-hint>jar</role-hint>
+      <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      <configuration>
+        <lifecycles>
+          <lifecycle>
+            <id>default</id>
+            <!-- START SNIPPET: jar-lifecycle -->
+            <phases>
+              <process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
+              <compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
+              <process-test-resources>
+                org.apache.maven.plugins:maven-resources-plugin:testResources
+              </process-test-resources>
+              <test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
+              <test></test>
+              <package>
+                org.apache.maven.plugins:maven-jar-plugin:jar
+              </package>
+              <install>org.apache.maven.plugins:maven-install-plugin:install</install>
+              <deploy></deploy>
+            </phases>
+            <!-- END SNIPPET: jar-lifecycle -->
+          </lifecycle>
+        </lifecycles>
+      </configuration>
+    </component>
+
+    <component>
+      <role>org.apache.maven.plugin.version.PluginVersionManager</role>
+      <role-hint>default</role-hint>
+      <implementation>org.apache.maven.plugin.version.DefaultPluginVersionManager</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+      <requirements>
+        <requirement>
+          <role>org.apache.maven.artifact.metadata.ArtifactMetadataSource</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.plugin.registry.MavenPluginRegistryBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.artifact.factory.ArtifactFactory</role>
+        </requirement>
+        <requirement>
+          <role>org.codehaus.plexus.components.interactivity.InputHandler</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.project.MavenProjectBuilder</role>
+        </requirement>
+        <requirement>
+          <role>org.apache.maven.execution.RuntimeInformation</role>
+        </requirement>
+      </requirements>
+    </component>
+
+    <component>
+      <role>org.sonatype.plexus.components.sec.dispatcher.SecDispatcher</role>
+      <role-hint>maven</role-hint>
+      <implementation>org.sonatype.plexus.components.sec.dispatcher.DefaultSecDispatcher</implementation>
+      <description>Maven Security dispatcher</description>
+      <requirements>
+        <requirement>
+          <role>org.sonatype.plexus.components.cipher.PlexusCipher</role>
+          <field-name>_cipher</field-name>
+        </requirement>
+      </requirements>
+      <configuration>
+        <_configuration-file>~/.m2/settings-security.xml</_configuration-file>
+      </configuration>
+    </component>    
+  </components>
+</component-set>

Modified: trunk/maven-ant-helper/debian/changelog
===================================================================
--- trunk/maven-ant-helper/debian/changelog	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/debian/changelog	2009-07-01 14:43:30 UTC (rev 8705)
@@ -1,3 +1,25 @@
+maven-ant-helper (5) unstable; urgency=low
+
+  * Change section to java, bump up Standards-Version: 3.8.1.
+  * Add myself to uploaders
+  * Add a Build-Depends-Indep dependency on ${misc:Depends}
+  * Fix ModelloTask to work with modello >= 1.0, add new properties
+    useJava5 and encoding. 
+  * maven-build.xml: add build.javaVersion property to allow
+    building Java 1.5 sources with this script, defaults to 1.4,
+    fix javadoc target to use any packages under the current sources
+  * Change the dependency on java-gcj to default-jdk (Closes: #526298)
+  * Support optional source folders
+  * Use maven-repo-helper to clean and include the pom information
+    into the META-INF folder, as Maven does
+  * Add support for running Maven plugins without using the full Maven
+    program. Great for building core Maven plugins used in the Maven
+    build itself.
+  * Add Recommends on libmaven2-core-java and maven-repo-helper as those
+    are used in optional parts of maven-build.xml
+
+ -- Ludovic Claude <ludovic.claude at laposte.net>  Mon, 30 Mar 2009 18:11:32 +0100
+
 maven-ant-helper (4) experimental; urgency=low
 
   * Update modello ant task to support the new modello package.

Modified: trunk/maven-ant-helper/debian/control
===================================================================
--- trunk/maven-ant-helper/debian/control	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/debian/control	2009-07-01 14:43:30 UTC (rev 8705)
@@ -1,19 +1,26 @@
 Source: maven-ant-helper
-Section: devel
+Section: java
 Priority: extra
 Maintainer: Debian Java Maintainers <pkg-java-maintainers at lists.alioth.debian.org>
-Uploaders: Trygve Laugstøl <trygvis at inamo.no>, Paul Cager <paul-debian at home.paulcager.org>, Torsten Werner <twerner at debian.org>
-Build-Depends: ant, debhelper (>= 5), cdbs (>= 0.4.5.3)
-Build-Depends-Indep: java-gcj-compat-dev (>=1.0.65), ant-optional
-Standards-Version: 3.8.0
+Uploaders: Trygve Laugstøl <trygvis at inamo.no>, Paul Cager <paul-debian at home.paulcager.org>, 
+ Torsten Werner <twerner at debian.org>, Ludovic Claude <ludovic.claude at laposte.net>
+Build-Depends: debhelper (>= 5), cdbs (>= 0.4.5.3), default-jdk
+Build-Depends-Indep: ant, ant-optional
+Standards-Version: 3.8.1
 Vcs-Svn: svn://svn.debian.org/svn/pkg-java/trunk/maven-ant-helper
 Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/maven-ant-helper/
 Homepage: http://svn.debian.org/wsvn/pkg-java/trunk/maven-ant-helper
 
 Package: maven-ant-helper
 Architecture: all
-Section: devel
-Recommends: libmodello-java (>= 1.0-alpha-21-1)
+Section: java
+Depends: ${misc:Depends}
+Recommends: libmodello-java (>= 1.0), libmaven2-core-java, maven-repo-helper
 Description: helper scripts for building Maven components with ant
  An environment that can be used to simplify the creation of Debian packages
  to support the Maven system. A "modello" ant task is also provided.
+ . 
+ maven-build.xml attempts to reproduce the Maven build life-cycle.
+ You can use it to build your jar or javadoc. If you have libmaven2-core-java
+ installed, you can even use it to launch some Maven plugins to generate 
+ some code.

Modified: trunk/maven-ant-helper/debian/rules
===================================================================
--- trunk/maven-ant-helper/debian/rules	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/debian/rules	2009-07-01 14:43:30 UTC (rev 8705)
@@ -6,13 +6,11 @@
 
 PACKAGE              := $(shell dpkg-parsechangelog | egrep '^Source:' | cut -f2 -d' ')
 VERSION              := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f2 -d' ')
-JAVA_HOME            := /usr/lib/jvm/java-gcj
-ANT_HOME             := /usr/share/ant
+JAVA_HOME            := /usr/lib/jvm/default-java
 DEB_JARS             := $(ANT_HOME)/lib/ant-launcher.jar $(ANT_HOME)/lib/ant-trax.jar xalan2 
 DEB_ANT_BUILD_TARGET := package
 DEB_ANT_BUILDFILE    := ./debian/build.xml
 DEB_ANT_ARGS         := -DartifactId=$(PACKAGE) -Dpackage=$(PACKAGE) -Dversion=$(VERSION) -propertyfile debian/build.properties
-SVN                  := http://svn.debian.org/svn/pkg-java/trunk/maven-ant-helper
 
 binary-post-install/$(PACKAGE)::
 	dh_install build/$(PACKAGE)-$(VERSION).jar usr/share/java
@@ -20,3 +18,4 @@
 	dh_installdirs -A usr/share/maven-ant-helper
 	dh_install maven-build.xml usr/share/maven-ant-helper
 	dh_install maven-defaults.properties usr/share/maven-ant-helper
+	dh_install bootstrap usr/share/maven-ant-helper

Added: trunk/maven-ant-helper/manifest.mf
===================================================================
--- trunk/maven-ant-helper/manifest.mf	                        (rev 0)
+++ trunk/maven-ant-helper/manifest.mf	2009-07-01 14:43:30 UTC (rev 8705)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+X-COMMENT: Main-Class will be added automatically by build
+

Modified: trunk/maven-ant-helper/maven-build.xml
===================================================================
--- trunk/maven-ant-helper/maven-build.xml	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/maven-build.xml	2009-07-01 14:43:30 UTC (rev 8705)
@@ -1,10 +1,171 @@
 <?xml version="1.0"?>
 
-<project name="pkg-java" default="package" basedir="..">
+<project name="pkg-java" default="package" basedir=".">
 
-    <target name="init">
-        <available property="available.resources" file="src/main/resources"/>
+    <!--
+       maven-build.xml - an Ant build script that reproduces the Maven build life-cycle.
 
+       You can use the following properties when launching this script:
+       
+       basedir: you need to supply the basedir, otherwise Ant will use the current location of this script,
+         which is not what you want. For example, use: 
+           DEB_ANT_ARGS := -Dpackage=$(realpath .)
+       package: the name of the source package. For example, use: 
+           DEB_ANT_ARGS := -Dversion=$(DEB_SOURCE_PACKAGE) 
+       bin.package: the name of the binary package. Defaults to lib${package}-java
+       version: the version of the project, used in the name of the jar. Prefer to use the Debian version 
+         here as it makes the rules file easier to write when the version contains alpha, beta or rc versions.
+         For example, use: 
+           DEB_ANT_ARGS := -Dversion=$(DEB_UPSTREAM_VERSION) 
+       debian.dir: the location of the debian directory. Defaults to ${basedir}/debian
+       project.dir: the location of the current project. Defaults to ""
+       pom.name: the name of the pom file. Must appear as it is in the debian/${bin.package}.poms file
+       pom.file: the location of the pom file. Defaults to ${pom.name}
+       maven.generate.target: if set, calls Maven with the given target before compiling code. For example, use
+          maven.generate.target = plugin:generate to generate the plugin descriptor for a Maven plugin.
+       maven.generate.target2: if set, calls Maven with another given target before compiling code. For example, use
+          maven.generate.target2 = org.codehaus.plexus:plexus-component-metadata:${plexus-component-metadata.version}:generate-metadata
+          to generate the Plexus components descriptor.
+       maven.package.target: if set, calls Maven with the given target after packaging the jar. For example, use
+          maven.target.target = shade:shade to use the shade plugin and repackage the contents of the jar.
+       keep-cleaned-pom: if set, keeps the cleaned pom after packaging. If can be restored later by calling
+          maven-build.xml with the restore-pom target (without the keep-cleaned-pom property set).
+       use-local-repo: if set, then Maven will use a local repository copied from /usr/share/maven-repo into
+          debian/tmp. This allows you to install some custom or intermediate artifacts, handy for multi modules builds.
+
+       If you provide a pom file to your project, or the project already contains a pom file,
+       then it will be read. You need to add /usr/share/java/ant-nodeps.jar to the classpath
+       for this functionality to work.
+ 
+       When using the Maven target, you need to add libmaven2-core-java to Build-Depends, as well as the
+       library containing the Maven plugin to execute (libmaven-plugin-tools-java for plugin:generate, 
+       libplexus-component-metadata-java for org.codehaus.plexus:plexus-component-metadata:generate-metadata)
+     -->
+
+    <property name="bin.package" value="lib${package}-java" />
+    <property name="debian.dir" value="${basedir}/debian" />
+    <property name="project.dir" value="" />
+    <property file="${debian.dir}/build.properties"/>
+    <property file="/usr/share/maven-ant-helper/maven-defaults.properties"/>
+
+    <target name="init.pom">
+        <condition property="use-local-repo" value="true">
+            <isset property="maven.package.target" />
+        </condition>
+        <condition property="pom.file" value="pom.xml">
+            <not>
+                <isset property="pom.name" />
+            </not>
+        </condition>
+        <condition property="pom.name" value="pom.xml" else="${project.dir}/pom.xml">
+            <equals arg1="" arg2="${project.dir}" />
+        </condition>
+        <property name="pom.file" value="${pom.name}" />
+        <available property="available.pom" file="${pom.file}"/>
+
+        <echo message="Base dir is ${basedir}" />
+        <echo message="Pom name in ${bin.package}.poms: ${pom.name}" />
+        <echo message="Pom file ${pom.file} available? ${available.pom}" />
+
+        <path id="maven.classpath">
+          <pathelement location="/usr/share/maven-ant-helper/bootstrap"/>
+          <fileset dir="/usr/share/maven-repo">
+            <include name="backport-util-concurrent/backport-util-concurrent/debian/backport-util-concurrent-debian.jar"/>
+            <include name="classworlds/classworlds/debian/classworlds-debian.jar"/>
+            <include name="com/jcraft/jsch/debian/jsch-debian.jar"/>
+            <include name="commons-cli/commons-cli/debian/commons-cli-debian.jar"/>
+            <include name="junit/junit/debian/junit-debian.jar"/>
+            <include name="xml-apis/xml-apis/debian/xml-apis-debian.jar"/>
+            <include name="org/apache/maven/doxia/doxia-logging-api/debian/doxia-logging-api-debian.jar"/>
+            <include name="org/apache/maven/doxia/doxia-sink-api/debian/doxia-sink-api-debian.jar"/>
+            <include name="org/apache/maven/maven-artifact/debian/maven-artifact-debian.jar"/>
+            <include name="org/apache/maven/maven-artifact-manager/debian/maven-artifact-manager-debian.jar"/>
+            <include name="org/apache/maven/maven-core/debian/maven-core-debian.jar"/>
+            <include name="org/apache/maven/maven-error-diagnostics/debian/maven-error-diagnostics-debian.jar"/>
+            <include name="org/apache/maven/maven-model/debian/maven-model-debian.jar"/>
+            <include name="org/apache/maven/maven-monitor/debian/maven-monitor-debian.jar"/>
+            <include name="org/apache/maven/maven-plugin-api/debian/maven-plugin-api-debian.jar"/>
+            <include name="org/apache/maven/maven-plugin-descriptor/debian/maven-plugin-descriptor-debian.jar"/>
+            <include name="org/apache/maven/maven-plugin-parameter-documenter/debian/maven-plugin-parameter-documenter-debian.jar"/>
+            <include name="org/apache/maven/maven-plugin-registry/debian/maven-plugin-registry-debian.jar"/>
+            <include name="org/apache/maven/maven-profile/debian/maven-profile-debian.jar"/>
+            <include name="org/apache/maven/maven-project/debian/maven-project-debian.jar"/>
+            <include name="org/apache/maven/maven-repository-metadata/debian/maven-repository-metadata-debian.jar"/>
+            <include name="org/apache/maven/maven-settings/debian/maven-settings-debian.jar"/>
+            <include name="org/apache/maven/reporting/maven-reporting-api/debian/maven-reporting-api-debian.jar"/>
+            <include name="org/apache/maven/wagon/wagon-provider-api/debian/wagon-provider-api-debian.jar"/>
+            <include name="org/apache/maven/wagon/wagon-ssh-common/debian/wagon-ssh-common-debian.jar"/>
+            <include name="org/apache/maven/wagon/wagon-ssh/debian/wagon-ssh-debian.jar"/>
+            <include name="org/codehaus/plexus/plexus-container-default/1.0-alpha/plexus-container-default-1.0-alpha.jar"/>
+            <include name="org/codehaus/plexus/plexus-interactivity-api/debian/plexus-interactivity-api-debian.jar"/>
+            <include name="org/codehaus/plexus/plexus-interpolation/debian/plexus-interpolation-debian.jar"/>
+            <include name="org/codehaus/plexus/plexus-utils/debian/plexus-utils-debian.jar"/>
+            <include name="org/sonatype/plexus/plexus-cipher/debian/plexus-cipher-debian.jar"/>
+            <include name="org/sonatype/plexus/plexus-sec-dispatcher/debian/plexus-sec-dispatcher-debian.jar"/>
+          </fileset>
+        </path>
+
+    </target>
+
+    <!-- /usr/share/java/ant-nodeps.jar must be in the classpath -->
+    <target name="read.pom" depends="init.pom" if="available.pom">
+
+        <loadfile srcfile="${debian.dir}/${bin.package}.poms" property="cleaner.options">
+            <filterchain>
+               <linecontains>
+                   <contains value="${pom.name}" />
+               </linecontains>
+               <tokenfilter>
+                 <containsregex
+                     pattern="[^ ]*(.*)"
+                     replace="\1"/>
+               </tokenfilter>
+               <striplinebreaks/>
+            </filterchain>
+        </loadfile>
+        <!-- default empty value -->
+        <property name="cleaner.options" value=""/>
+        <echo message="Cleaner options: ${cleaner.options}" />
+
+        <mkdir dir="${debian.dir}/tmp" /> 
+        <delete>
+           <fileset dir="${debian.dir}/tmp">
+              <include name="pom.xml" />
+              <include name="pom.properties" />
+           </fileset>
+        </delete> 
+
+        <property name="pom.loc" location="${pom.file}" />
+        <echo message="Cleaning pom ${pom.loc}" />
+
+        <java fork="true" dir="." 
+           classpath="/usr/share/maven-repo/org/debian/maven/maven-repo-helper/debian/maven-repo-helper-debian.jar"
+           classname="org.debian.maven.repo.POMCleaner">
+           <arg value="-p${bin.package}" />
+           <arg value="-r${debian.dir}/maven.rules" />
+           <arg value="-i${debian.dir}/maven.publishedRules" />
+           <arg value="--verbose" />
+           <arg line="${cleaner.options} --keep-pom-version" />
+           <arg value="${pom.loc}" />
+           <arg value="${debian.dir}/tmp/pom.xml" />
+           <arg value="${debian.dir}/tmp/pom.properties" />
+        </java> 
+        <copy file="${pom.file}" tofile="${pom.file}.save" />
+        <!-- force the pom file to be located in the current dir, we'll need it when running Maven plugins -->
+        <copy file="${debian.dir}/tmp/pom.xml" tofile="${pom.file}" overwrite="true" />
+        <property file="${debian.dir}/tmp/pom.properties"/>
+
+        <echo message="Properties read from the POM file:" />
+        <echo message="  groupId: ${groupId}" />
+        <echo message="  artifactId: ${artifactId}" />
+    </target>
+
+    <target name="init" depends="read.pom">
+        <available property="available.sources" file="${build.sourceDirectory}"/>
+        <available property="available.resources" file="${build.resourcesDirectory}"/>
+        <available property="available.testResources" file="${build.testResourcesDirectory}"/>
+        <available property="available.testSources" file="${build.testSourceDirectory}"/>
+
         <fail unless="artifactId" message="Missing required property: artifactId"/>
         <fail unless="version" message="Missing required property: version"/>
         <fail unless="basedir" message="Missing required property: basedir"/>
@@ -30,38 +191,108 @@
      <target name="process-resources" depends="init" if="available.resources">
         <mkdir dir="${build.outputDirectory}"/>
         <copy todir="${build.outputDirectory}">
-            <fileset dir="src/main/resources"/>
+            <fileset dir="${build.resourcesDirectory}"/>
         </copy>
      </target>
 
-    <target name="compile" depends="process-resources">
+    <target name="process-pom" depends="init" if="available.pom">
+        <mkdir dir="${build.outputDirectory}/META-INF/maven/${groupId}/${artifactId}"/>
+        <copy todir="${build.outputDirectory}/META-INF/maven/${groupId}/${artifactId}">
+            <fileset dir="${debian.dir}/tmp">
+               <include name="pom.xml" />
+               <include name="pom.properties" />
+            </fileset>
+        </copy>
+    </target>
+
+    <macrodef name="run-maven">
+      <attribute name="target"/>
+      <sequential>
+        <java fork="true" dir="." classname="org.apache.maven.cli.MavenCli" failonerror="true">
+          <jvmarg value="-Xmx256M"/>
+          <classpath refid="maven.classpath"/>
+          <arg value="-Dmaven.test.skip"/>
+          <arg value="--offline"/>
+          <arg value="-e"/>
+          <arg value="-B"/>
+          <arg value="-s${debian.dir}/maven-settings.xml"/>
+          <arg value="@{target}"/>
+        </java>
+      </sequential>      
+    </macrodef>
+
+    <macrodef name="run-maven-local-repo">
+      <attribute name="target"/>
+      <sequential>
+        <mkdir dir="${debian.dir}/tmp/maven-repo" /> 
+        <copy todir="${debian.dir}/tmp/maven-repo">
+            <fileset dir="/usr/share/maven-repo" />
+        </copy>
+
+        <java fork="true" dir="." classname="org.apache.maven.cli.MavenCli" failonerror="true">
+          <jvmarg value="-Xmx256M"/>
+          <classpath refid="maven.classpath"/>
+          <arg value="-Dmaven.test.skip"/>
+          <arg value="--offline"/>
+          <arg value="-e"/>
+          <arg value="-B"/>
+          <arg value="--offline"/>
+          <arg value="-Dmaven.repo.local=${debian.dir}/tmp/maven-repo"/>
+          <arg value="@{target}"/>
+        </java>
+      </sequential>      
+    </macrodef>
+
+    <target name="mvn-shared-repo" unless="use-local-repo">
+        <!-- Calls mvn ${maven.generate.target} -->
+        <run-maven target="${_target}" />
+    </target>
+    <target name="mvn-local-repo" if="use-local-repo">
+        <!-- Calls mvn ${maven.generate.target} -->
+        <run-maven-local-repo target="${_target}" />
+    </target>
+    <target name="mvn" depends="mvn-shared-repo,mvn-local-repo" />
+
+    <target name="mvn-generate" depends="init" if="maven.generate.target">
+        <antcall target="mvn" inheritRefs="true">
+            <param name="_target" value="${maven.generate.target}" />
+        </antcall> 
+    </target>
+
+    <target name="mvn-generate2" depends="init" if="maven.generate.target2">
+        <antcall target="mvn" inheritRefs="true">
+            <param name="_target" value="${maven.generate.target2}" />
+        </antcall> 
+    </target>
+
+    <target name="compile" depends="process-resources,process-pom,mvn-generate,mvn-generate2" if="available.sources">
         <mkdir dir="${build.outputDirectory}"/>
         <mkdir dir="${build.directory}/generated-sources"/>
         <javac
             destdir="${build.outputDirectory}"
             classpath="${classpath.compile}"
             nowarn="true"
-            source="1.4" target="1.4"
+            source="${build.javaVersion}" target="${build.javaVersion}"
             debug="on">
             <src path="${build.sourceDirectory}"/>
             <src path="${build.directory}/generated-sources"/>
         </javac>
     </target>
 
-    <target name="process-test-resources" depends="compile" unless="maven.test.skip">
+    <target name="process-test-resources" depends="compile" if="available.testResources" unless="maven.test.skip">
         <mkdir dir="${build.testOutputDirectory}"/>
         <copy todir="${build.testOutputDirectory}">
-            <fileset dir="src/test/resources"/>
+            <fileset dir="${build.testResourcesDirectory}"/>
         </copy>
      </target>
 
-    <target name="test-compile" depends="process-test-resources" unless="maven.test.skip">
+    <target name="test-compile" depends="process-test-resources" if="available.testSources" unless="maven.test.skip">
         <mkdir dir="${build.testOutputDirectory}"/>
         <javac
             destdir="${build.testOutputDirectory}"
             classpath="${classpath.full.test}"
             nowarn="true"
-            source="1.4" target="1.4"
+            source="${build.javaVersion}" target="${build.javaVersion}"
             debug="on">
             <src path="${build.testSourceDirectory}"/>
         </javac>
@@ -86,17 +317,39 @@
         </junit>
     </target>
 
-    <target name="package" depends="test">
-<!--
-        <delete file="${jar}"/>
-
-        <mkdir dir="${build.directory}/META-INF/maven/org.codehaus.modello/modello-core" />
-        <copy file="./modello-core/pom.xml" todir="${build.directory}/META-INF/maven/org.codehaus.modello/modello-core" />
--->
+    <target name="jar" depends="test">
         <jar jarfile="${build.directory}/${artifactId}-${version}.jar"
             basedir="${build.outputDirectory}"/>
     </target>
 
+    <target name="mvn-package" depends="jar" if="maven.package.target">
+        <!-- do a POM transform in order to keep important plugin configuration for Maven -->
+        <delete file="${pom.file}" />
+        <echo message="Transform ${pom.file}" />
+        <java fork="true" dir="." 
+           classpath="/usr/share/maven-repo/org/debian/maven/maven-repo-helper/debian/maven-repo-helper-debian.jar"
+           classname="org.debian.maven.repo.POMCleaner">
+           <arg value="-p${bin.package}" />
+           <arg value="-r${debian.dir}/maven.rules" />
+           <arg value="-i${debian.dir}/maven.publishedRules" />
+           <arg value="--verbose" />
+           <arg value="--keep-all-elements" />
+           <arg line="${cleaner.options} --keep-pom-version" />
+           <arg value="${pom.file}.save" />
+           <arg value="${pom.file}" />
+           <arg value="${debian.dir}/tmp/pom.properties" />
+        </java> 
+        <!-- Calls mvn ${maven.package.target} -->
+        <run-maven-local-repo target="${maven.package.target}" />
+    </target>
+
+    <target name="restore-pom" depends="init.pom" unless="keep-cleaned-pom"> 
+        <!-- restore the pom file -->
+        <copy file="${pom.file}.save" tofile="${pom.file}" overwrite="true"/>
+    </target>
+ 
+    <target name="package" depends="jar,mvn-package,restore-pom" />
+
     <!--
      | Javadoc
      |-->
@@ -104,7 +357,7 @@
     <target name="javadoc">
         <mkdir dir="${javadoc.dir}"/>
         <javadoc 
-            packagenames="org.codehaus.*"
+            source="${build.javaVersion}"
             sourcepath="${build.sourceDirectory}"
             destdir="${javadoc.dir}"
             author="true"
@@ -112,6 +365,11 @@
             windowtitle="${package} API"
             doctitle="${package} - ${version}"
             classpath="${classpath.full.compile}" >
+
+            <packageset dir="${build.sourceDirectory}" defaultexcludes="yes">
+                <include name="**"/>
+            </packageset>
+
         </javadoc>
     </target>
 </project>

Modified: trunk/maven-ant-helper/maven-defaults.properties
===================================================================
--- trunk/maven-ant-helper/maven-defaults.properties	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/maven-defaults.properties	2009-07-01 14:43:30 UTC (rev 8705)
@@ -2,11 +2,14 @@
 # See http://maven.apache.org/ref/current/maven-model/maven.html for nams
 build.sourceDirectory=src/main/java
 build.testSourceDirectory=src/test/java
+build.resourcesDirectory=src/main/resources
+build.testResourcesDirectory=src/test/resources
 
 build.directory=build
-build.outputDirectory=build/classes
-build.testOutputDirectory=build/test-classes
-javadoc.dir=${build.directory}/javadoc
+build.outputDirectory=${build.directory}/classes
+build.testOutputDirectory=${build.directory}/test-classes
+build.javaVersion=1.4
+javadoc.dir=${build.directory}/docs/api
 classpath.compile=
 classpath.test=
 classpath.full.compile=${build.outputDirectory}:${classpath.compile}

Modified: trunk/maven-ant-helper/src/main/java/ModelloTask.java
===================================================================
--- trunk/maven-ant-helper/src/main/java/ModelloTask.java	2009-07-01 11:23:44 UTC (rev 8704)
+++ trunk/maven-ant-helper/src/main/java/ModelloTask.java	2009-07-01 14:43:30 UTC (rev 8705)
@@ -1,6 +1,7 @@
 import java.lang.reflect.*;
 import java.io.*;
 import java.net.*;
+import java.util.*;
 import org.apache.tools.ant.*;
 
 /*
@@ -25,6 +26,9 @@
     private String output;
     private String version;
     private boolean packageWithVersion;
+    private boolean useJava5;
+    private String encoding = "UTF-8";
+    private List classpath = new ArrayList();
 
     public void execute() throws BuildException {
         ClassLoader cl = Thread.currentThread().getContextClassLoader();
@@ -46,30 +50,42 @@
         }
     }
 
+    private void addToClassPath(String jar) throws Exception {
+        if (! new File(jar).exists()) {
+            System.err.println("Cannot find file " + jar);
+			System.exit(1);
+        }
+        classpath.add(new URL( "file:" + jar));
+    }
+
+    private URL[] getClassPath() {
+        return (URL[]) classpath.toArray(new URL[classpath.size()]);
+    }
+
     private void work() throws Exception {
         log( "Running the '" + plugin + "' Modello plugin using model file " + model + " for version " + version );
 
-        URL[] urls = new URL[] {
-            new URL( "file:/usr/share/java/plexus-utils.jar" ),
-            new URL( "file:/usr/share/java/plexus-classworlds.jar" ),
-            new URL( "file:/usr/share/java/plexus-container-default-1.0.jar" ),
-            new URL( "file:/usr/share/java/modello-core.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-converters.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-dom4j.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-jdom.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-jpox.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-plexus-registry.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-stax.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-store.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-xdoc.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-xml.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-xpp3.jar" ),
-            new URL( "file:/usr/share/java/modello-plugin-xsd.jar" ),
-            new URL( "file:/usr/share/java/google-collect.jar" ),
-            new URL( "file:/usr/share/java/xbean-reflect.jar" ),
-        };
+        addToClassPath("/usr/share/java/plexus-build-api.jar");
+        addToClassPath("/usr/share/java/plexus-utils.jar");
+        addToClassPath("/usr/share/java/plexus-classworlds.jar");
+        addToClassPath("/usr/share/java/plexus-container-default.jar");
+        addToClassPath("/usr/share/java/modello-core.jar");
+        addToClassPath("/usr/share/java/modello-plugin-converters.jar");
+        addToClassPath("/usr/share/java/modello-plugin-dom4j.jar");
+        addToClassPath("/usr/share/java/modello-plugin-java.jar");
+        addToClassPath("/usr/share/java/modello-plugin-jdom.jar");
+            // new URL( "file:/usr/share/java/modello-plugin-jpox.jar");
+            // new URL( "file:/usr/share/java/modello-plugin-plexus-registry.jar");
+        addToClassPath("/usr/share/java/modello-plugin-stax.jar");
+            // new URL( "file:/usr/share/java/modello-plugin-store.jar");
+        addToClassPath("/usr/share/java/modello-plugin-xdoc.jar");
+        addToClassPath("/usr/share/java/modello-plugin-xml.jar");
+        addToClassPath("/usr/share/java/modello-plugin-xpp3.jar");
+        addToClassPath("/usr/share/java/modello-plugin-xsd.jar");
+        addToClassPath("/usr/share/java/google-collections.jar");
+        addToClassPath("/usr/share/java/xbean-reflect.jar");
 
-        ClassLoader cl = new URLClassLoader( urls );
+        ClassLoader cl = new URLClassLoader( getClassPath() );
 
         Thread.currentThread().setContextClassLoader( cl );
 
@@ -78,11 +94,21 @@
             plugin,
             output,
             version,
-            Boolean.toString( packageWithVersion )};
+            Boolean.toString( packageWithVersion ),
+            Boolean.toString( useJava5 ),
+            encoding};
 
-        Class modelloCli = cl.loadClass( "org.codehaus.modello.ModelloCli" );
-        Method main = modelloCli.getMethod( "main", new Class[] { String[].class } );
-        main.invoke( null, new Object[] { args } );
+		try {
+	        Class modelloCli = cl.loadClass( "org.codehaus.modello.ModelloCli" );
+	        Method main = modelloCli.getMethod( "main", new Class[] { String[].class } );
+	        main.invoke( null, new Object[] { args } );
+		} catch (Error e) {
+			e.printStackTrace();
+			throw e;
+		} catch (RuntimeException e) {
+			e.printStackTrace();
+			throw e;
+		}
     }
 
     public void setModel( String model ) {
@@ -104,4 +130,13 @@
     public void setPackageWithVersion( boolean packageWithVersion ) {
         this.packageWithVersion = packageWithVersion;
     }
+
+    public void setUseJava5( boolean useJava5 ) {
+        this.useJava5 = useJava5;
+    }
+
+    public void setEncoding( String encoding ) {
+        this.encoding = encoding;
+    }
+
 }




More information about the pkg-java-commits mailing list