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


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion committed 2004-05-06 05:43:13 +00:00
1 parent 89fde49f23
commit fdd0eebc51
5 files changed
+134 -35

No files matched your search

@@ -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>
</j:whitespace>
+66 -6
View File
@@ -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>
+7
View File
@@ -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>
+4
View File
@@ -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>
+45 -28
View File
@@ -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>