Granting the wish of sam ;)

Mvgr,
Martin

On Tue, 2002-07-23 at 00:27, Martin van den Bemt wrote:
> If failed the build on xml-rpc (jsse dependency).
> Now just gives a warning. The former patch hereby is obsolete..
> 
> mvgr,
> Martin
> 
> On Mon, 2002-07-22 at 23:40, Martin van den Bemt wrote:
> > Let's try that again :
> > 
> > If I don't also oeverride the arraylist in Resources.java, it thinks it
> > must use the includes and excludes from unitTest instead of the includes
> > and excludes from unitTest/resources..
> > Pff.. Next time I try to read my mail before I sent it ..
> > 
> > Mvgr,
> > Martin
> > 
> > On Mon, 2002-07-22 at 23:37, Martin van den Bemt wrote:
> > > It will not work without it, so to speak, since the resources specified
> > > is something else than unitTest ;)..
> > > If I don't override the arraylist also in the class, it things it must
> > > used the uniteTest includes/excludes instead of the
> > > unitTest/resources/includes/excludes..
> > > 
> > > Mvgr,
> > > martin
> > > 
> > > 
> > > On Mon, 2002-07-22 at 23:33, bob mcwhirter wrote:
> > > > On 22 Jul 2002, Martin van den Bemt wrote:
> > > > 
> > > > > Hi everyone,
> > > > > 
> > > > > I added some targets to the maven generated build.xml 
> > > > > (javadoc and tests). This need came up (at least for the tests) when
> > > > > someone had a bad day and wasn't able to get maven installed in a normal
> > > > > timespan..
> > > > > 
> > > > > I also added the following tags to the project.xml :
> > > > > 
> > > > > <unitTest>
> > > > >   <resources>
> > > > >     <excludes/>
> > > > >     <includes/>
> > > > >   </resources>
> > > > > </unitTest>
> > > > > 
> > > > > These tags are needed to have a simple way to copy over resources that
> > > > > are needed by testcase (eg .betwixt, .properties files)..
> > > > 
> > > > I don't think you need the <resources> tag there, though. 
> > > > 
> > > > UnitTest extends Resources.
> > > > 
> > > >         -bob
> > > > 
> > > > 
> > > > --
> > > > To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > > --
> > > To unsubscribe, e-mail:   
><mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail: 
><mailto:[EMAIL PROTECTED]>
> > > 
> > > 
> > 
> > 
> > 
> > --
> > To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> > 
> > 
> 
> ----
> 

> ? karel.txt
> ? src/plugins-build/plugins
> ? src/plugins-build/deploy/target
> Index: src/java/org/apache/maven/project/UnitTest.java
> ===================================================================
> RCS file: 
>/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/UnitTest.java,v
> retrieving revision 1.1
> diff -u -r1.1 UnitTest.java
> --- src/java/org/apache/maven/project/UnitTest.java   28 Jun 2002 01:59:35 -0000     
> 1.1
> +++ src/java/org/apache/maven/project/UnitTest.java   22 Jul 2002 22:24:14 -0000
> @@ -62,7 +62,35 @@
>  /** Collects unit-test include and exclude patterns.
>   *
>   *  @author <a href="mailto:[EMAIL PROTECTED]";>bob mcwhirter</a>
> + *  @author <a href="mailto:[EMAIL PROTECTED]";>Martin van den Bemt</a>
>   */
>  public class UnitTest extends Resources
>  {
> +    private Resources resources;
> +    private List includes;
> +    private List excludes; 
> +    
> +    public UnitTest()
> +    {
> +        this.includes = new ArrayList();
> +        this.excludes = new ArrayList();
> +    }
> +    
> +    /**
> +     * Sets the test resources
> +     * @param resources
> +     */
> +    public void setResources(Resources resources)
> +    {
> +        this.resources = resources;
> +    }
> +    
> +    /**
> +     * Gets the resources
> +     * @return
> +     */
> +    public Resources getResources()
> +    {
> +        return this.resources;
> +    }
>  }
> Index: src/plugins-build/ant/plugin.jelly
> ===================================================================
> RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/ant/plugin.jelly,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 plugin.jelly
> --- src/plugins-build/ant/plugin.jelly        14 Jul 2002 19:09:02 -0000      1.1.1.1
> +++ src/plugins-build/ant/plugin.jelly        22 Jul 2002 22:24:15 -0000
> @@ -23,18 +23,26 @@
>      <j:file name="build.xml">
>      <j:whitespace>
>  <project name="${pom.id}" default="jar" basedir=".">
> -
> +  
> +  <property name="defaulttargetdir" value="target"/> 
> +  <property name="classesdir" value="target/classes"/>
> +  <property name="testclassesdir" value="target/test-classes"/>
> +  <property name="testreportdir" value="target/test-reports"/>
> +  <property name="distdir" value="dist"/>
> +  <property name="javadocdir" value="target/docs/apidocs"/>
> +  
>    <target
>      name="jar"
> -    depends="get-deps">
> +    depends="get-deps"
> +    description="o Create the jar">
>  
> -    <mkdir dir="target/classes"/>
> +    <mkdir dir="$${classesdir}"/>
>  
>      <javac
> -      destdir="target/classes"
> +      destdir="$${classesdir}"
>        excludes="**/package.html"
> -      debug="false"
> -      deprecation="false"
> +      debug="true"
> +      deprecation="true"
>        optimize="false">
>        <src>
>          <pathelement location="${pom.build.sourceDirectory}"/>
> @@ -46,28 +54,169 @@
>        </classpath>
>      </javac>
>  
> +    <j:if test="${maven.has.jar.resource.patterns}">
> + 
> +    <!-- Copy any resources that must be present in the deployed
> +         JAR file.
> +    -->
> + 
> +    <copy todir="$${classesdir}">
> +      <fileset dir="${maven.jarResources.basedir}">
> +      <j:forEach var="res" items="${pom.build.resources.includes}">
> +        <include name="${res}"/>
> +      </j:forEach>
> +      <j:forEach var="res" items="${pom.build.resources.excludes}">
> +        <exclude name="${res}"/>
> +      </j:forEach>
> +      </fileset>
> +    </copy>
> + 
> +    </j:if>
>      <jar
>        jarfile="target/${maven.final.name}.jar"
> -      basedir="target/classes"
> +      basedir="$${classesdir}"
>        excludes="**/package.html"
>      />
>  
>    </target>
>    
>    <target
> -    name="clean">
> -    <delete dir="target"/>
> -    <delete dir="dist"/>
> +    name="clean"
> +    description="o Clean up the generated directories">
> +    <delete dir="$${defaulttargetdir}"/>
> +    <delete dir="$${distdir}"/>
>    </target>
>  
>    <target
>      name="dist"
> -    depends="jar">
> +    depends="jar, javadoc"
> +    description="o Create a distribution">
>      <mkdir dir="dist"/>
>      <copy todir="dist">
> -      <fileset dir="target"/>
> +      <fileset dir="$${defaulttargetdir}"/>
>      </copy>
>    </target>
> + 
> +  <target
> +    name="test"
> +    depends="compile-tests"
> +    description="o Run the test cases">
> +    <mkdir dir="$${testreportdir}"/>
> +    <junit printSummary="yes"
> +           haltonerror="true"
> +           fork="true"
> +           dir="./">
> +      <sysproperty key="basedir" value="${pom.build.unitTestSourceDirectory}"/>
> +      <formatter type="xml"/>
> +      <formatter type="plain" usefile="true"/>
> +      <classpath>
> +        <fileset dir="lib">
> +          <include name="*.jar"/>
> +        </fileset>
> +        <pathelement location="target/${maven.final.name}.jar"/>
> +        <pathelement path="$${testclassesdir}"/>
> +      </classpath>
> +      <batchtest todir="$${testreportdir}">
> +        <fileset dir="${pom.build.unitTestSourceDirectory}">
> +              <j:forEach var="pat" items="${pom.build.unitTest.includes}">
> +                <include name="${pat}"/>
> +              </j:forEach>
> +              <j:forEach var="pat" items="${pom.build.unitTest.excludes}">
> +                <exclude name="${pat}"/>
> +              </j:forEach>
> +        </fileset>
> +      </batchtest>
> +    </junit>
> +  </target>
> +
> +  <target 
> +    name="compile-tests"
> +    depends="jar">
> +    <mkdir dir="$${testclassesdir}"/>
> +    <javac
> +      destdir="$${testclassesdir}"
> +      excludes="**/package.html"
> +      debug="true"
> +      deprecation="true"
> +      optimize="false">
> +      <src>
> +        <pathelement location="${pom.build.unitTestSourceDirectory}"/>
> +      </src>
> +      <classpath>
> +        <fileset dir="lib">
> +          <include name="*.jar"/>
> +        </fileset>
> +        <pathelement location="target/${maven.final.name}.jar"/>
> +      </classpath>
> +    </javac>
> +
> +    <j:choose trim="true">
> +      <j:when test="${!pom.build.unitTest.resources.includes.isEmpty()}">
> +         <j:set var="maven.has.test.resource.patterns" value="true"/>
> +       </j:when>
> +       <j:when test="${!pom.build.unitTest.resources.excludes.isEmpty()}">
> +         <j:set var="maven.has.test.resource.patterns" value="true"/>
> +       </j:when>
> +    </j:choose>
> +   
> +    <j:if test="${maven.has.test.resource.patterns}">
> + 
> +    <copy todir="$${testclassesdir}">
> +      <fileset dir="${pom.build.unitTestSourceDirectory}">
> +      <j:forEach var="res" items="${pom.build.unitTest.resources.includes}">
> +         <include name="${res}"/>
> +      </j:forEach>
> +      <j:forEach var="res" items="${pom.build.unitTest.resources.excludes}">
> +         <exclude name="${res}"/>
> +      </j:forEach>
> +      </fileset>
> +    </copy>
> +    </j:if>
> +  </target>
> +
> +  <target
> +    name="javadoc"
> +    depends="jar"
> +    description="o Generate javadoc">
> + 
> + 
> +    <mkdir dir="$${javadocdir}"/>
> + 
> +    <!-- Get the year to display in the Javadocs -->
> +    <tstamp>
> +      <format property="year" pattern="${pom.inceptionYear}-yyyy"/>
> +    </tstamp>
> + 
> +    <property
> +      name="copyright"      
> +      value="Copyright &amp;copy; ${year} ${pom.organization.name}. All Rights 
>Reserved."
> +    />
> + 
> +    <property
> +      name="title"
> +      value="${pom.name} ${pom.currentVersion} API"
> +    />
> + 
> +    <javadoc
> +      sourcepath="${pom.build.sourceDirectory}"
> +      packagenames="${pom.package}.*"
> +      destdir="$${javadocdir}"
> +      author="true"
> +      private="true"
> +      version="true"
> +      use="true"
> +      windowtitle="${title}"
> +      doctitle="${title}"
> +      bottom="${copyright}">
> +      <classpath>
> +        <fileset dir="lib">
> +          <include name="*.jar"/>
> +        </fileset>
> +        <pathelement location="target/${maven.final.name}.jar"/>
> +      </classpath>
> +    </javadoc>
> + 
> +  </target>
>  
>    <target
>      name="get-deps">
> @@ -78,6 +227,7 @@
>        src="${maven.repo.remote}${dep.id}/jars/${dep.jar}"
>        dest="lib/${dep.jar}"
>        usetimestamp="true"
> +      ignoreerrors="true"
>      /></j:forEach>
>    
>    </target>
> 
> ----
> 

> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Index: src/java/org/apache/maven/project/UnitTest.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/project/UnitTest.java,v
retrieving revision 1.1
diff -u -r1.1 UnitTest.java
--- src/java/org/apache/maven/project/UnitTest.java	28 Jun 2002 01:59:35 -0000	1.1
+++ src/java/org/apache/maven/project/UnitTest.java	22 Jul 2002 22:52:24 -0000
@@ -62,7 +62,35 @@
 /** Collects unit-test include and exclude patterns.
  *
  *  @author <a href="mailto:[EMAIL PROTECTED]";>bob mcwhirter</a>
+ *  @author <a href="mailto:[EMAIL PROTECTED]";>Martin van den Bemt</a>
  */
 public class UnitTest extends Resources
 {
+    private Resources resources;
+    private List includes;
+    private List excludes; 
+    
+    public UnitTest()
+    {
+        this.includes = new ArrayList();
+        this.excludes = new ArrayList();
+    }
+    
+    /**
+     * Sets the test resources
+     * @param resources
+     */
+    public void setResources(Resources resources)
+    {
+        this.resources = resources;
+    }
+    
+    /**
+     * Gets the resources
+     * @return
+     */
+    public Resources getResources()
+    {
+        return this.resources;
+    }
 }
Index: src/plugins-build/ant/plugin.jelly
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/plugins-build/ant/plugin.jelly,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 plugin.jelly
--- src/plugins-build/ant/plugin.jelly	14 Jul 2002 19:09:02 -0000	1.1.1.1
+++ src/plugins-build/ant/plugin.jelly	22 Jul 2002 22:52:25 -0000
@@ -23,18 +23,29 @@
     <j:file name="build.xml">
     <j:whitespace>
 <project name="${pom.id}" default="jar" basedir=".">
-
+  
+  <property name="defaulttargetdir" value="target"/> 
+  <property name="classesdir" value="target/classes"/>
+  <property name="testclassesdir" value="target/test-classes"/>
+  <property name="testreportdir" value="target/test-reports"/>
+  <property name="distdir" value="dist"/>
+  <property name="javadocdir" value="target/docs/apidocs"/>
+  <condition property="noget">
+    <equals arg1="${build.sysclasspath}" arg2="only"/>
+  </condition>
+  
   <target
     name="jar"
-    depends="get-deps">
+    depends="get-deps"
+    description="o Create the jar">
 
-    <mkdir dir="target/classes"/>
+    <mkdir dir="$${classesdir}"/>
 
     <javac
-      destdir="target/classes"
+      destdir="$${classesdir}"
       excludes="**/package.html"
-      debug="false"
-      deprecation="false"
+      debug="true"
+      deprecation="true"
       optimize="false">
       <src>
         <pathelement location="${pom.build.sourceDirectory}"/>
@@ -46,31 +57,173 @@
       </classpath>
     </javac>
 
+    <j:if test="${maven.has.jar.resource.patterns}">
+ 
+    <!-- Copy any resources that must be present in the deployed
+         JAR file.
+    -->
+ 
+    <copy todir="$${classesdir}">
+      <fileset dir="${maven.jarResources.basedir}">
+      <j:forEach var="res" items="${pom.build.resources.includes}">
+        <include name="${res}"/>
+      </j:forEach>
+      <j:forEach var="res" items="${pom.build.resources.excludes}">
+        <exclude name="${res}"/>
+      </j:forEach>
+      </fileset>
+    </copy>
+ 
+    </j:if>
     <jar
       jarfile="target/${maven.final.name}.jar"
-      basedir="target/classes"
+      basedir="$${classesdir}"
       excludes="**/package.html"
     />
 
   </target>
   
   <target
-    name="clean">
-    <delete dir="target"/>
-    <delete dir="dist"/>
+    name="clean"
+    description="o Clean up the generated directories">
+    <delete dir="$${defaulttargetdir}"/>
+    <delete dir="$${distdir}"/>
   </target>
 
   <target
     name="dist"
-    depends="jar">
+    depends="jar, javadoc"
+    description="o Create a distribution">
     <mkdir dir="dist"/>
     <copy todir="dist">
-      <fileset dir="target"/>
+      <fileset dir="$${defaulttargetdir}"/>
     </copy>
   </target>
+ 
+  <target
+    name="test"
+    depends="compile-tests"
+    description="o Run the test cases">
+    <mkdir dir="$${testreportdir}"/>
+    <junit printSummary="yes"
+           haltonerror="true"
+           fork="true"
+           dir="./">
+      <sysproperty key="basedir" value="${pom.build.unitTestSourceDirectory}"/>
+      <formatter type="xml"/>
+      <formatter type="plain" usefile="true"/>
+      <classpath>
+        <fileset dir="lib">
+          <include name="*.jar"/>
+        </fileset>
+        <pathelement location="target/${maven.final.name}.jar"/>
+        <pathelement path="$${testclassesdir}"/>
+      </classpath>
+      <batchtest todir="$${testreportdir}">
+        <fileset dir="${pom.build.unitTestSourceDirectory}">
+              <j:forEach var="pat" items="${pom.build.unitTest.includes}">
+                <include name="${pat}"/>
+              </j:forEach>
+              <j:forEach var="pat" items="${pom.build.unitTest.excludes}">
+                <exclude name="${pat}"/>
+              </j:forEach>
+        </fileset>
+      </batchtest>
+    </junit>
+  </target>
+
+  <target 
+    name="compile-tests"
+    depends="jar">
+    <mkdir dir="$${testclassesdir}"/>
+    <javac
+      destdir="$${testclassesdir}"
+      excludes="**/package.html"
+      debug="true"
+      deprecation="true"
+      optimize="false">
+      <src>
+        <pathelement location="${pom.build.unitTestSourceDirectory}"/>
+      </src>
+      <classpath>
+        <fileset dir="lib">
+          <include name="*.jar"/>
+        </fileset>
+        <pathelement location="target/${maven.final.name}.jar"/>
+      </classpath>
+    </javac>
+
+    <j:choose trim="true">
+      <j:when test="${!pom.build.unitTest.resources.includes.isEmpty()}">
+         <j:set var="maven.has.test.resource.patterns" value="true"/>
+       </j:when>
+       <j:when test="${!pom.build.unitTest.resources.excludes.isEmpty()}">
+         <j:set var="maven.has.test.resource.patterns" value="true"/>
+       </j:when>
+    </j:choose>
+   
+    <j:if test="${maven.has.test.resource.patterns}">
+ 
+    <copy todir="$${testclassesdir}">
+      <fileset dir="${pom.build.unitTestSourceDirectory}">
+      <j:forEach var="res" items="${pom.build.unitTest.resources.includes}">
+         <include name="${res}"/>
+      </j:forEach>
+      <j:forEach var="res" items="${pom.build.unitTest.resources.excludes}">
+         <exclude name="${res}"/>
+      </j:forEach>
+      </fileset>
+    </copy>
+    </j:if>
+  </target>
+
+  <target
+    name="javadoc"
+    depends="jar"
+    description="o Generate javadoc">
+ 
+ 
+    <mkdir dir="$${javadocdir}"/>
+ 
+    <!-- Get the year to display in the Javadocs -->
+    <tstamp>
+      <format property="year" pattern="${pom.inceptionYear}-yyyy"/>
+    </tstamp>
+ 
+    <property
+      name="copyright"      
+      value="Copyright &amp;copy; ${year} ${pom.organization.name}. All Rights Reserved."
+    />
+ 
+    <property
+      name="title"
+      value="${pom.name} ${pom.currentVersion} API"
+    />
+ 
+    <javadoc
+      sourcepath="${pom.build.sourceDirectory}"
+      packagenames="${pom.package}.*"
+      destdir="$${javadocdir}"
+      author="true"
+      private="true"
+      version="true"
+      use="true"
+      windowtitle="${title}"
+      doctitle="${title}"
+      bottom="${copyright}">
+      <classpath>
+        <fileset dir="lib">
+          <include name="*.jar"/>
+        </fileset>
+        <pathelement location="target/${maven.final.name}.jar"/>
+      </classpath>
+    </javadoc>
+ 
+  </target>
 
   <target
-    name="get-deps">
+    name="get-deps"
+    unless="noget">
   
     <mkdir dir="lib"/>
     <j:forEach var="dep" items="${pom.dependencies}">
@@ -78,6 +231,7 @@
       src="${maven.repo.remote}${dep.id}/jars/${dep.jar}"
       dest="lib/${dep.jar}"
       usetimestamp="true"
+      ignoreerrors="true"
     /></j:forEach>
   
   </target>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to