You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2004/05/06 07:43:13 UTC

cvs commit: maven-plugins/eclipse/src/plugin-resources/templates project.jelly

dion        2004/05/05 22:43:13

  Modified:    eclipse/src/plugin-test project.xml maven.xml
               eclipse/xdocs properties.xml changes.xml
               eclipse/src/plugin-resources/templates project.jelly
  Log:
  Added maven.eclipse.buildcommands and maven.eclipse.projectnatures
  Added tests for them
  
  PR: MPECLIPSE-25
  Obtained from: Miguel Griffa
  Submitted by:	Miguel Griffa
  Reviewed by:	dIon Gillard
  
  Revision  Changes    Path
  1.3       +7 -0      maven-plugins/eclipse/src/plugin-test/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-test/project.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.xml	4 Mar 2004 18:04:37 -0000	1.2
  +++ project.xml	6 May 2004 05:43:12 -0000	1.3
  @@ -53,5 +53,12 @@
     </developers>
   
     <build>
  +    <dependencies>
  +      <dependency>
  +        <groupId>commons-jelly</groupId>
  +        <artifactId>commons-jelly-tags-xml</artifactId>
  +        <version>20030211.142705</version>
  +      </dependency>
  +    </dependencies>
     </build>
   </project>
  
  
  
  1.4       +66 -6     maven-plugins/eclipse/src/plugin-test/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-test/maven.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- maven.xml	5 May 2004 06:16:27 -0000	1.3
  +++ maven.xml	6 May 2004 05:43:12 -0000	1.4
  @@ -17,18 +17,78 @@
    -->
   <project xmlns:j="jelly:core" 
            xmlns:assert="assert" 
  -         xmlns:u="jelly:util">
  +         xmlns:u="jelly:util"
  +         xmlns:x="jelly:xml">
   
  -  <goal name="testPlugin" prereqs="test-eclipse">
  +  <goal name="testPlugin" prereqs="test-init,test-eclipse,test-natures,test-builders,test-natures-and-builders">
  +  </goal>
  +  
  +  <goal name="test-init">
  +    <j:set var="dotProject" value="${basedir}/.project"/>
  +    <j:set var="dotClasspath" value="${basedir}/.classpath"/>
     </goal>
     
     <goal name="test-eclipse">
  -    <delete file="${basedir}/.project" failonerror="false"/>
  -    <delete file="${basedir}/.classpath" failonerror="false"/>
  +    <delete file="${dotProject}" failonerror="false"/>
  +    <delete file="${dotClasspath}" failonerror="false"/>
       <attainGoal name="eclipse"/>
   
  -    <assert:assertFileExists file="${basedir}/.project" />
  -    <assert:assertFileExists file="${basedir}/.classpath" />
  +    <assert:assertFileExists file="${dotProject}" />
  +    <assert:assertFileExists file="${dotClasspath}" />
   
     </goal>
  +
  + <goal name="test-natures">
  +   <delete file="${dotProject}" failonerror="false"/>
  +   <j:set var="maven.eclipse.projectnatures" value="n1,a.b.c.n2"/>
  +   <attainGoal name="eclipse:generate-project"/>
  +
  +   <assert:assertFileExists file="${dotProject}" />
  +
  +   <u:file var="projectFile" name="${dotProject}"/>
  +   <x:parse var="projectDoc" xml="${projectFile.toURL()}" />
  +   <x:set var="natures" select="$projectDoc/projectDescription/natures/nature"/>
  +   <assert:assertEquals expected="n1" value="${natures[1].text}" msg="n1 is not the second nature"/>
  +   <assert:assertEquals expected="a.b.c.n2" value="${natures[2].text}" msg="a.b.c.n2 is not the third nature"/>
  + </goal>
  +
  + <goal name="test-builders">
  +   <j:set var="maven.eclipse.buildcommands" value="c1,c2,c3"/>
  +   <delete file="${dotProject}" failonerror="false"/>
  +   <attainGoal name="eclipse:generate-project"/>
  +
  +   <assert:assertFileExists file="${dotProject}" />
  +   <u:file var="projectFile" name="${dotProject}"/>
  +   <x:parse var="projectDoc" xml="${projectFile.toURL()}" />
  +   <x:set var="builders" select="$projectDoc/projectDescription/buildSpec/buildCommand/name"/>
  +
  +   <assert:assertEquals expected="c1" value="${builders[1].text}" msg="c1 is not the second build command name"/>
  +   <assert:assertEquals expected="c2" value="${builders[2].text}" msg="c2 is not the third build command name"/>
  +   <assert:assertEquals expected="c3" value="${builders[3].text}" msg="c3 is not the fourth build command name"/>
  + </goal>
  +
  +
  + <goal name="test-natures-and-builders">
  +   <delete file="${dotProject}" failonerror="false"/>
  +   <j:set var="maven.eclipse.projectnatures" value="n7,n9,n11"/>
  +   <j:set var="maven.eclipse.buildcommands" value="c11,c21,c31"/>
  +   <attainGoal name="eclipse:generate-project"/>
  +
  +   <assert:assertFileExists file="${dotProject}" />
  +   <u:file var="projectFile" name="${dotProject}"/>
  +   <x:parse var="projectDoc" xml="${projectFile.toURL()}" />
  +   <x:set var="natures"  select="$projectDoc/projectDescription/natures/nature"/>
  +   <x:set var="builders" select="$projectDoc/projectDescription/buildSpec/buildCommand/name"/>
  +
  +   <!-- check natures -->
  +   <assert:assertEquals expected="n7" value="${natures[1].text}" msg="n7 is not the second nature"/>
  +   <assert:assertEquals expected="n9" value="${natures[2].text}" msg="n9 is not the second nature"/>
  +   <assert:assertEquals expected="n11" value="${natures[3].text}" msg="n11 is not the second nature"/>
  +
  +   <!-- check builders -->
  +   <assert:assertEquals expected="c11" value="${builders[1].text}" msg="c11 is not the second build command name"/>
  +   <assert:assertEquals expected="c21" value="${builders[2].text}" msg="c21 is not the second build command name"/>
  +   <assert:assertEquals expected="c31" value="${builders[3].text}" msg="c31 is not the second build command name"/>
  + </goal>
  +
   </project>
  
  
  
  1.8       +45 -28    maven-plugins/eclipse/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/xdocs/properties.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- properties.xml	4 Mar 2004 18:04:37 -0000	1.7
  +++ properties.xml	6 May 2004 05:43:12 -0000	1.8
  @@ -33,17 +33,17 @@
             <td>maven.eclipse.workspace</td>
             <td>Yes</td>
             <td>
  -			Location of the <a href="http://www.eclipse.org">Eclipse</a>
  -			workspace that holds your configuration and source.
  -			<p>
  -			  On Windows, this will be the <code>workspace</code> directory
  -			  under your eclipse installation. For example, if you installed
  -			  eclipse into <code>c:\eclipse</code>, the workspace is 
  -			  <code>c:\eclipse\workspace</code>.
  -			</p>
  -			<p>
  -			  If this parameter is specified, the <a href="goals.html#eclipse:external-tools">
  -			  external-tools</a> goal will use it as the destination to copy the generated file.
  +      Location of the <a href="http://www.eclipse.org">Eclipse</a>
  +      workspace that holds your configuration and source.
  +      <p>
  +        On Windows, this will be the <code>workspace</code> directory
  +        under your eclipse installation. For example, if you installed
  +        eclipse into <code>c:\eclipse</code>, the workspace is 
  +        <code>c:\eclipse\workspace</code>.
  +      </p>
  +      <p>
  +        If this parameter is specified, the <a href="goals.html#eclipse:external-tools">
  +        external-tools</a> goal will use it as the destination to copy the generated file.
               </p>
             </td>
           </tr>
  @@ -51,44 +51,61 @@
             <td>maven.eclipse.junit</td>
             <td>Yes (default=3.8.1)</td>
             <td>
  -			The version of JUnit you want added to your project. If this
  -			property is set to <code>none</code> then JUnit will not be added to your 
  -			build classpath.
  +            The version of JUnit you want added to your project. If this
  +            property is set to <code>none</code> then JUnit will not be added to your 
  +            build classpath.
             </td>
           </tr>
           <tr>
             <td>maven.eclipse.output.dir</td>
             <td>Yes (default=${maven.build.dest)</td>
             <td>
  -			The directory to which Eclipse should output its classes.
  -			By default this is the same directory as Maven generates its code
  -			however this can be changed so that <code>maven clean</code>
  -			does not interfere with Eclipse's build.
  +            The directory to which Eclipse should output its classes.
  +            By default this is the same directory as Maven generates its code
  +            however this can be changed so that <code>maven clean</code>
  +            does not interfere with Eclipse's build.
             </td>
           </tr>
           <tr>
             <td>maven.eclipse.test.output.dir</td>
             <td>Yes (default=${maven.test.dest} defined in test plugin)</td>
             <td>
  -			The directory to which Eclipse should output its test classes.
  +            The directory to which Eclipse should output its test classes.
             </td>
           </tr>
           <tr>
             <td>maven.eclipse.classpath.include</td>
             <td>Yes</td>
             <td>
  -			Comma delimited list of additional directories to include in 
  -			the classpath, like <code>src/conf</code>.
  +            Comma delimited list of additional directories to include in 
  +            the classpath, like <code>src/conf</code>.
  +          </td>
  +        </tr>
  +         <tr>
  +          <td>maven.eclipse.buildcommands</td>
  +          <td>Yes</td>
  +          <td>
  +            Comma delimited list of additional build commands 
  +            to include in the project description file.
  +          </td>
  +        </tr>
  +          <tr>
  +          <td>maven.eclipse.projectnatures</td>
  +          <td>Yes</td>
  +          <td>
  +            Comma delimited list of additional project natures
  +            to include in the project description file. These natures
  +            will be added after the java nature.
             </td>
           </tr>
         </table>
  -	  <p>
  -		Note that you will need to defined a <code>MAVEN_REPO</code> Java 
  -		Classpath variable in Eclipse. This is done by selecting the Window
  -		menu, then Preferences. In the dialog box, select the Java node and
  -		then Classpath Variables. Create a new variable named 
  -		<code>MAVEN_REPO</code> that points to your local Maven repository.
  -	  </p>
  +      <p>
  +        Note that you will need to defined a <code>MAVEN_REPO</code> Java 
  +        Classpath variable in Eclipse. This is done by selecting the Window
  +        menu, then Preferences. In the dialog box, select the Java node and
  +        then Classpath Variables. Create a new variable named 
  +        <code>MAVEN_REPO</code> that points to your local Maven repository.
  +      </p>
       </section>
     </body>
   </document>
  
  
  
  1.17      +4 -0      maven-plugins/eclipse/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/xdocs/changes.xml,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- changes.xml	5 May 2004 06:16:27 -0000	1.16
  +++ changes.xml	6 May 2004 05:43:13 -0000	1.17
  @@ -25,6 +25,10 @@
     </properties>
     <body>
       <release version="1.7-SNAPSHOT" date="in CVS">
  +      <action dev="dion" type="update" issue="MPECLIPSE-25" due-to="Miguel Griffa">
  +        Add maven.eclipse.buildcommands and maven.eclipse.projectnatures properties, docs
  +        and test cases
  +      </action>
         <action dev="dion" type="update">use assert taglib for testing</action>
         <action dev="brett" type="update" issue="MPECLIPSE-21">Honour sourceModifications in classpath file</action>
         <action dev="dion" type="fix" issue="MPECLIPSE-22">used container for JRE classpath</action>
  
  
  
  1.5       +12 -1     maven-plugins/eclipse/src/plugin-resources/templates/project.jelly
  
  Index: project.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/eclipse/src/plugin-resources/templates/project.jelly,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.jelly	4 Mar 2004 18:04:37 -0000	1.4
  +++ project.jelly	6 May 2004 05:43:13 -0000	1.5
  @@ -42,10 +42,21 @@
         <arguments>
         </arguments>
       </buildCommand>
  +    <util:tokenize var="commands" delim=",">${maven.eclipse.buildcommands}</util:tokenize>
  +    <j:forEach var="command" items="${commands}" trim="true">
  +    <buildCommand>
  +      <name>${command}</name>
  +      <arguments/>
  +    </buildCommand>
  +    </j:forEach>
     </buildSpec>
     <natures>
       <nature>org.eclipse.jdt.core.javanature</nature>
  +    <util:tokenize var="natures" delim=",">${maven.eclipse.projectnatures}</util:tokenize>
  +    <j:forEach var="nature" items="${natures}" trim="true">
  +    <nature>${nature}</nature>
  +    </j:forEach>
     </natures>
   </projectDescription>
   
  -</j:whitespace>
  \ No newline at end of file
  +</j:whitespace>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org