committing MPECLIPSE-101 - aggregate patch for the following MPECLIPSE issues:

MPECLIPSE-96 classpathentry contains trailing pipe character that confuses Eclipse 3.1
MPECLIPSE-80 Generate .wtpmodules files
MPECLIPSE-78 avoid duplicated builders/natures
MPECLIPSE-63 don't want the hardcoded org.eclipse.jdt.core.javabuilder
MPECLIPSE-92 Setting relative path value to "maven.eclipse.output.dir" generates wrong absolute classpath entry
MPECLIPSE-72 Failing use cases for projects with just resources
MPECLIPSE-57 Make sourcepath more flexible



git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@310226 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
fgiust 2005-10-09 16:50:48 +00:00
parent 4fda1a9e01
commit 888d258c82
27 changed files with 1018 additions and 315 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0"?>
<!--
<!--
/*
* 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.
@ -18,16 +18,17 @@
-->
<project
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:test="test"
xmlns:util="jelly:util"
xmlns:define="jelly:define"
xmlns:maven="jelly:maven">
xmlns:maven="jelly:maven"
>
<define:taglib uri="eclipse">
<define:taglib uri="eclipse">
<define:tag name="write-classpath-entry">
<maven:param-check value="${groupId}" fail="true" message="'groupId' must be specified"/>
<maven:param-check value="${artifactId}" fail="true" message="'artifactId' must be specified"/>
@ -38,53 +39,102 @@
<j:if test='${relativePathCheck == "X"}'>
<j:set var="relativePath" value="${groupId}/jars/${artifactId}-${version}.jar" />
</j:if>
<!--
should be (m1 repo layout):
${groupId}/java-sources/${artifactId}-${version}-sources.jar
-->
<!-- deprecated: check it first and use it if available, elsewhere set the new path -->
<j:set var="mappedsrc" value="${groupId}/src/${artifactId}-${version}.${maven.eclipse.src.extension}"/>
<util:file var="checkSrcExist" name="${maven.repo.local}/${mappedsrc}" />
<util:file var="srcFile" name="${maven.repo.local}/${mappedsrc}"/>
<j:choose>
<j:when test="${checkSrcExist.exists()}">
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}" />
<j:when test="${srcFile.exists()}">
<ant:echo>deprecated: java sources for ${artifactId} found at MAVEN_REPO/${mappedsrc}, please use the path MAVEN_REPO/${groupId}/java-sources/${artifactId}-${version}-sources.jar</ant:echo>
</j:when>
<j:otherwise>
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" />
<j:set var="mappedsrc" value="${groupId}/java-sources/${artifactId}-${version}-sources.jar"/>
<util:file var="srcFile" name="${maven.repo.local}/${mappedsrc}"/>
<j:if test="${!srcFile.exists()}">
<ant:echo>Place java sources for ${artifactId} at ${maven.repo.local}/${mappedsrc} for javadoc and debugging support in Eclipse</ant:echo>
</j:if>
</j:otherwise>
</j:choose>
<j:set var="jdocs" value="${groupId}/javadoc.jars/${artifactId}-${version}.javadoc.jar"/>
<classpathentry kind="var" path="MAVEN_REPO/${relativePath}" sourcepath="MAVEN_REPO/${mappedsrc}">
<!-- javadoc need to be an absolute path in eclipse 3.1, the MAVEN_REPO var will not work
<attributes>
<attribute value="jar:file:/${maven.repo.local}/${jdocs}!/" name="javadoc_location"/>
</attributes>
-->
</classpathentry>
</define:tag>
</define:taglib>
<!--==================================================================-->
<!-- Generate Eclipse .project and .classpath files -->
<!--==================================================================-->
<!--==================================================================-->
<goal name="eclipse"
description="Generate Eclipse project files"
prereqs="eclipse:generate-project">
<j:if test="${sourcesPresent}">
<j:if test="${sourcesPresent or !pom.build.resources.isEmpty()}">
<attainGoal name="eclipse:generate-classpath" />
</j:if>
<!-- jelly trick, you can't use "-1" in comparisons -->
<j:set var="indexnotfound" value="${0-1}" />
<!-- another jelly trick, you can't call methods on variables with a dot -->
<j:set var="mepn" value="${maven.eclipse.projectnatures}x" />
<j:if test="${mepn.indexOf('org.eclipse.wst.common.modulecore.ModuleCoreNature') != indexnotfound}">
<attainGoal name="eclipse:generate-wtpmodules" />
</j:if>
<ant:echo>Now refresh your project in Eclipse (right click on the project and select "Refresh")</ant:echo>
</goal>
<goal name="eclipse:generate-project"
description="Generate Eclipse .project file">
<ant:echo>Creating ${basedir}/.project ...</ant:echo>
<j:file name="${basedir}/.project" prettyPrint="true" xmlns="dummy">
<j:import file="${plugin.resources}/templates/project.jelly" inherit="true"/>
<j:import file="${plugin.resources}/templates/project.jelly" inherit="true"/>
</j:file>
</goal>
<!--==================================================================-->
<!-- Generate Eclipse .classpath file -->
<!--==================================================================-->
<!--==================================================================-->
<goal name="eclipse:generate-classpath"
description="Generate Eclipse .classpath file">
<ant:echo>Creating ${basedir}/.classpath ...</ant:echo>
<ant:echo>Creating ${basedir}/.classpath ...</ant:echo>
<j:file name="${basedir}/.classpath" prettyPrint="true" outputMode="xml" xmlns="dummy">
<j:import file="${plugin.resources}/templates/classpath.jelly" inherit="true"/>
<j:import file="${plugin.resources}/templates/classpath.jelly" inherit="true"/>
</j:file>
</goal>
<!--==================================================================-->
<!-- Generate Eclipse .wtpmodules file -->
<!--==================================================================-->
<goal name="eclipse:generate-wtpmodules"
description="Generate Eclipse .wtpmodules file">
<ant:echo>Creating ${basedir}/.wtpmodules ...</ant:echo>
<j:file name="${basedir}/.wtpmodules" prettyPrint="true" outputMode="xml" xmlns="dummy">
<j:import file="${plugin.resources}/templates/wtpmodules.jelly" inherit="true"/>
</j:file>
</goal>
@ -101,13 +151,13 @@
<j:set var="os" value="${os.name}" />
<j:set var="windows" value="${os.toLowerCase().indexOf('windows') != '-1'}"/>
<ant:echo>Adapting the generated file for a ${os} box.</ant:echo>
<!-- Strangely, j:file inserts a space between ${maven.home} and /bin/maven ... -->
<!-- Strangely, j:file inserts a space between ${maven.home} and /bin/maven ... -->
<j:set var="tool.loc" value="${maven.home}${file.separator}bin${file.separator}maven"/>
<j:if test="${windows}">
<j:set var="tool.loc" value="${tool.loc}.bat"/>
</j:if>
<j:file name="${toolFile}" prettyPrint="true" xmlns="dummy">
<externaltools>
<j:set var="project" value="${org.apache.commons.jelly.werkz.Project}"/>
@ -144,17 +194,17 @@
</j:forEach>
</externaltools>
</j:file>
<j:set var="ws" value="${maven.eclipse.workspace}X" />
<j:if test='${ws != "X"}'>
<j:set var="toDir" value="${maven.eclipse.workspace}/.metadata/.plugins/org.eclipse.ui.externaltools/" />
<ant:copy file="${toolFile}" todir="${toDir}"/>
</j:if>
<j:if test='${ws == "X"}'>
<ant:echo>
Please set maven.eclipse.workspace to the location of your eclipse workspace.
Alternatively, copy
Alternatively, copy
${maven.build.dir}/eclipse/externaltools.xml
to
[maven.eclipse.workspace]/.metadata/.plugins/org.eclipse.ui.externaltools/externaltools.xml
@ -175,8 +225,8 @@
<j:set var="os" value="${os.name}" />
<j:set var="windows" value="${os.toLowerCase().indexOf('windows') != '-1'}"/>
<ant:echo>Adapting the generated file for a ${os} box.</ant:echo>
<!-- Strangely, j:file inserts a space between ${maven.home} and /bin/maven ... -->
<!-- Strangely, j:file inserts a space between ${maven.home} and /bin/maven ... -->
<j:set var="tool.loc" value="${maven.home}${file.separator}bin${file.separator}maven"/>
<j:if test="${windows}">
<j:set var="tool.loc" value="${tool.loc}.bat"/>
@ -209,7 +259,7 @@
</j:file>
</j:if>
</j:forEach>
<j:set var="ws" value="${maven.eclipse.workspace}X" />
<j:if test='${ws != "X"}'>
<j:set var="toDir" value="${maven.eclipse.workspace}/.metadata/.plugins/org.eclipse.debug.core/.launches/" />
@ -217,11 +267,11 @@
<ant:fileset dir="${maven.build.dir}/eclipse/" includes="*.launch" />
</ant:copy>
</j:if>
<j:if test='${ws == "X"}'>
<ant:echo>
Please set maven.eclipse.workspace to the location of your eclipse workspace.
Alternatively, copy
Alternatively, copy
${maven.build.dir}/eclipse/*.launch
to
[maven.eclipse.workspace]/.metadata/.plugins/org.eclipse.debug.core/.launches/
@ -245,7 +295,7 @@
<!-- create the Eclipse property file if it is missing -->
<ant:mkdir dir="${variableDir}"/>
<ant:touch file="${variableFile}"/>
<ant:propertyfile file="${variableFile}">
<ant:entry key="org.eclipse.jdt.core.classpathVariable.MAVEN_REPO"
default="${maven.repo.local}" />
@ -254,19 +304,21 @@
<j:otherwise>The property $${maven.eclipse.workspace} was not set. MAVEN_REPO may not be set.</j:otherwise>
</j:choose>
</goal>
<!--==================================================================-->
<!-- Clean up eclipse generated files -->
<!--==================================================================-->
<goal name="eclipse:clean"
<goal name="eclipse:clean"
description="Clean eclipse generated files">
<j:set var="projectFileName" value="${basedir}/.project"/>
<j:set var="classpathFileName" value="${basedir}/.classpath"/>
<j:set var="wtpmodulesFileName" value="${basedir}/.wtpmodules"/>
<ant:delete file="${projectFileName}"/>
<ant:delete file="${classpathFileName}"/>
<ant:delete file="${wtpmodulesFileName}"/>
<ant:echo>Cleaned up eclipse generated files</ant:echo>
</goal>
</goal>
</project>

View File

@ -27,3 +27,4 @@ maven.eclipse.goals = plugins
maven.gen.src=${maven.build.dir}/generated-sources
maven.eclipse.src.extension = zip
maven.eclipse.resources.addtoclasspath=false
maven.eclipse.servletapilist=servletapi:servletapi,geronimo-spec:geronimo-spec-servlet

View File

@ -1,14 +1,14 @@
<?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.
@ -26,92 +26,8 @@
xmlns="dummy"
trim="true">
<classpath>
<classpath>
<j:if test="${unitTestSourcesPresent}">
<ant:echo>Contains JUnit tests</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}" separator="/"/>
</j:if>
<!-- set a flag so JUnit jar is included only once -->
<j:set var="ignoreJUnit" value="false" />
<j:if test="${unitTestSourcesPresent}">
<!-- Eclipse supports an output directory per input directory -->
<j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/>
<j:if test="${empty testOutputDir}">
<maven:get var="testOutputDir" plugin='maven-test-plugin' property='maven.test.dest'/>
</j:if>
<maven:makeRelativePath var="testOutputDir" basedir="${basedir}" path="${testOutputDir}" separator="/"/>
<ant:echo>Setting compile of ${testSrcDir} to ${testOutputDir}</ant:echo>
<classpathentry kind="src" path="${testSrcDir}" output="${testOutputDir}"/>
<u:tokenize var="conclasspaths" delim=",">${maven.eclipse.conclasspath}</u:tokenize>
<j:forEach var="conclasspath" items="${conclasspaths}" trim="true">
<classpathentry kind="con" path="${conclasspath}"/>
</j:forEach>
<!-- Here are the rules:
If the project has maven.eclipse.junit property, add that ver of junit
If the project has maven.eclipse.junit property and it is empty, don't add junit
If the project has junit dep, use that.
Use the test plugin version
-->
<j:set var="verX" value="${maven.eclipse.junit}X"/>
<maven:get var="testPlugin" plugin='maven-test-plugin' property='plugin' />
<j:set var="depVersion">${testPlugin.getDependency('junit').getVersion()}</j:set>
<j:if test="${pom.getDependency('junit') != null}">
<j:set var="depVersion" value="${pom.getDependency('junit').getVersion()}"/>
</j:if>
<j:if test="${verX != 'X'}">
<j:set var="depVersion">${maven.eclipse.junit}</j:set>
</j:if>
<j:if test="${verX == 'noneX'}">
<j:set var="depVersion" value="none"/>
</j:if>
<j:if test="${depVersion != 'none'}">
<eclipse:write-classpath-entry groupId="junit" artifactId="junit" version="${depVersion}" relativePath="" />
<j:set var="ignoreJUnit" value="true" />
</j:if>
<j:if test="${pom.build.unitTest != null}">
<j:if test="${maven.eclipse.resources.addtoclasspath}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.unitTest.resources}">
<j:set var="includingAsString" value="" />
<j:forEach var="res" items="${resource.includes}">
<j:set var="includingAsString" value="${includingAsString}${res}|" />
</j:forEach>
<j:set var="excludingAsString" value="" />
<j:forEach var="res" items="${resource.excludes}">
<j:set var="excludingAsString" value="${excludingAsString}${res}|" />
</j:forEach>
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/"/>
<!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(testSrcDir) and (!resourceDirectory.equals(srcDir) or !sourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" output="${testOutputDir}" including="${includingAsString}" excluding="${excludingAsString}"/>
</j:if>
</j:forEach>
</j:if>
</j:if>
</j:if>
</j:if>
<!-- Add any generated source directories as seperate src directories -->
<u:available file="${maven.gen.src}">
<u:file var="genSrcRootDir" name="${maven.gen.src}"/>
<j:forEach var="genSrcDir" items="${genSrcRootDir.listFiles()}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${genSrcDir}" separator="/"/>
<classpathentry kind="src" path="${srcDir}"/>
</j:forEach>
</u:available>
<j:if test="${sourcesPresent}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" separator="/"/>
@ -132,27 +48,134 @@
</j:if>
</j:forEach>
<classpathentry kind="src" path="${srcDir}" excluding="${excluding}" />
</j:if>
<j:if test="${maven.eclipse.resources.addtoclasspath}">
<j:if test="${!pom.build.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.resources}">
<j:set var="includingAsString" value="" />
<j:forEach var="res" items="${resource.includes}">
<j:choose>
<j:when test="${includingAsString.length() == 0}">
<j:set var="includingAsString" value="${res}"/>
</j:when>
<j:otherwise>
<j:set var="includingAsString" value="${includingAsString}|${res}"/>
</j:otherwise>
</j:choose>
</j:forEach>
<j:set var="excludingAsString" value="" />
<j:forEach var="res" items="${resource.excludes}">
<j:choose>
<j:when test="${excludingAsString.length() == 0}">
<j:set var="excludingAsString" value="${res}"/>
</j:when>
<j:otherwise>
<j:set var="excludingAsString" value="${excludingAsString}|${res}"/>
</j:otherwise>
</j:choose>
</j:forEach>
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/"/>
<u:file var="resourceDirectoryFile" name="${resource.directory}"/>
<!-- don't add duplicate directories -->
<j:if test="${resourceDirectoryFile.exists() and !resourceDirectory.equals(srcDir) and (!resourceDirectory.equals(testSrcDir) or !unitTestSourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" including="${includingAsString}" excluding="${excludingAsString}" />
</j:if>
</j:forEach>
</j:if>
</j:if>
<j:if test="${unitTestSourcesPresent}">
<ant:echo>Contains JUnit tests</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}" separator="/"/>
</j:if>
<!-- set a flag so JUnit jar is included only once -->
<j:set var="ignoreJUnit" value="false" />
<j:if test="${unitTestSourcesPresent}">
<!-- Eclipse supports an output directory per input directory -->
<j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/>
<j:if test="${empty testOutputDir}">
<maven:get var="testOutputDir" plugin='maven-test-plugin' property='maven.test.dest'/>
</j:if>
<maven:makeRelativePath var="testOutputDir" basedir="${basedir}" path="${testOutputDir}" separator="/"/>
<ant:echo>Setting compile of ${testSrcDir} to ${testOutputDir}</ant:echo>
<classpathentry kind="src" path="${testSrcDir}" output="${testOutputDir}"/>
<u:tokenize var="conclasspaths" delim=",">org.eclipse.jdt.launching.JRE_CONTAINER,${maven.eclipse.conclasspath}</u:tokenize>
<j:forEach var="conclasspath" items="${conclasspaths}" trim="true">
<classpathentry kind="con" path="${conclasspath}"/>
</j:forEach>
<!-- Here are the rules:
If the project has maven.eclipse.junit property, add that ver of junit
If the project has maven.eclipse.junit property and it is empty, don't add junit
If the project has junit dep, use that.
Use the test plugin version
-->
<j:set var="verX" value="${maven.eclipse.junit}X"/>
<maven:get var="testPlugin" plugin='maven-test-plugin' property='plugin' />
<j:set var="depVersion">${testPlugin.getDependency('junit').getVersion()}</j:set>
<j:if test="${pom.getDependency('junit') != null}">
<j:set var="depVersion" value="${pom.getDependency('junit').getVersion()}"/>
</j:if>
<j:if test="${verX != 'X'}">
<j:set var="depVersion">${maven.eclipse.junit}</j:set>
</j:if>
<j:if test="${verX == 'noneX'}">
<j:set var="depVersion" value="none"/>
</j:if>
<j:if test="${depVersion != 'none'}">
<eclipse:write-classpath-entry groupId="junit" artifactId="junit" version="${depVersion}" relativePath="" />
<j:set var="ignoreJUnit" value="true" />
</j:if>
</j:if>
<j:if test="${pom.build.unitTest != null}">
<j:if test="${maven.eclipse.resources.addtoclasspath}">
<j:if test="${!pom.build.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.resources}">
<j:if test="${!pom.build.unitTest.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.unitTest.resources}">
<j:set var="includingAsString" value="" />
<j:forEach var="res" items="${resource.includes}">
<j:set var="includingAsString" value="${includingAsString}${res}|" />
<j:if test="${includingAsString.length() &gt; 0}">
<j:set var="includingAsString" value="${includingAsString}|" />
</j:if>
<j:set var="includingAsString" value="${includingAsString}${res}" />
</j:forEach>
<j:set var="excludingAsString" value="" />
<j:set var="excludingAsString" value="" />
<j:forEach var="res" items="${resource.excludes}">
<j:set var="excludingAsString" value="${excludingAsString}${res}|" />
</j:forEach>
<j:if test="${excludingAsString.length() &gt; 0}">
<j:set var="excludingAsString" value="${excludingAsString}|" />
</j:if>
<j:set var="excludingAsString" value="${excludingAsString}${res}" />
</j:forEach>
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/"/>
<u:file var="resourceDirectoryFile" name="${resource.directory}"/>
<!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(srcDir) and (!resourceDirectory.equals(testSrcDir) or !unitTestSourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" including="${includingAsString}" excluding="${excludingAsString}" />
<j:if test="${resourceDirectoryFile.exists() and !resourceDirectory.equals(testSrcDir) and (!resourceDirectory.equals(srcDir) or !sourcesPresent)}">
<classpathentry kind="src" path="${resourceDirectory}" output="${testOutputDir}" including="${includingAsString}" excluding="${excludingAsString}"/>
</j:if>
</j:forEach>
</j:if>
</j:if>
</j:if>
<!-- Add any generated source directories as seperate src directories -->
<u:available file="${maven.gen.src}">
<u:file var="genSrcRootDir" name="${maven.gen.src}"/>
<j:forEach var="genSrcDir" items="${genSrcRootDir.listFiles()}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${genSrcDir}" separator="/"/>
<classpathentry kind="src" path="${srcDir}"/>
</j:forEach>
</u:available>
<!-- Add the list of additional directories for the classpath from ${maven.eclipse.classpath.include}-->
<u:tokenize var="maven.eclipse.classpath.include.split" delim=",">${maven.eclipse.classpath.include}</u:tokenize>
@ -179,10 +202,6 @@
<j:set var="ignoreCactus" value="true" />
</j:if>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="eclipseDependency"
value="${lib.dependency.getProperty('eclipse.dependency')}"/>
@ -192,7 +211,7 @@
</j:when>
<j:when test="${eclipseDependency == 'false'}">
<!-- ignore specific dependencies -->
</j:when>
</j:when>
<j:when test="${lib.dependency.groupId == 'junit' and ignoreJUnit}">
<!-- ignoring junit dependency as we've already created it -->
</j:when>
@ -218,14 +237,14 @@
</j:otherwise>
</j:choose>
</j:forEach>
<!-- add the unit test build directory so that any files generated via Maven are available -->
<!-- add the unit test build directory so that any files generated via Maven are available -->
<j:set var="outputDir" value="${maven.eclipse.output.dir}"/>
<j:if test="${empty outputDir}">
<j:set var="outputDir" value="${maven.build.dest}"/>
<j:set var="outputDir" value="${maven.build.dest}"/>
<maven:makeRelativePath var="outputDir" basedir="${basedir}" path="${outputDir}" separator="/"/>
</j:if>
<maven:makeRelativePath var="outputDir" basedir="${basedir}" path="${outputDir}" separator="/"/>
<classpathentry kind="output" path="${outputDir}"/>
<ant:echo>Setting default output directory to ${outputDir}</ant:echo>
</classpath>

View File

@ -1,14 +1,14 @@
<?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.
@ -23,41 +23,55 @@
xmlns:ant="jelly:ant"
xmlns="dummy"
trim="true">
<projectDescription>
<j:set var="fullprojectnatures" value="${maven.eclipse.projectnatures}" />
<j:set var="fullbuildcommands" value="${maven.eclipse.buildcommands}" />
<!-- add java nature/builder only if sources are present. Avoid duplicates -->
<!-- jelly trick, you can't use "-1" in comparisons -->
<j:set var="indexnotfound" value="${0-1}" />
<!-- another jelly trick, you can't call methods on variables with a dot -->
<j:set var="mepn" value="${maven.eclipse.projectnatures}x" />
<j:set var="mebc" value="${maven.eclipse.buildcommands}x" />
<j:if test="${sourcesPresent or !pom.build.resources.isEmpty()}">
<j:if test="${mepn.indexOf('org.eclipse.jdt.core.javanature') == indexnotfound}">
<j:set var="fullprojectnatures" value="org.eclipse.jdt.core.javanature,${maven.eclipse.projectnatures}" />
</j:if>
<j:if test="${mebc.indexOf('org.eclipse.jdt.core.javabuilder') == indexnotfound}">
<j:set var="fullbuildcommands" value="org.eclipse.jdt.core.javabuilder,${maven.eclipse.buildcommands}" />
</j:if>
</j:if>
<name>${pom.artifactId}</name>
<comment>${pom.description}</comment>
<projects>
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="eclipseDependency"
value="${lib.dependency.getProperty('eclipse.dependency')}"/>
<j:set var="eclipseDependency" value="${lib.dependency.getProperty('eclipse.dependency')}"/>
<j:if test="${eclipseDependency == 'true'}">
<project>${lib.dependency.artifactId}</project>
</j:if>
</j:forEach>
</projects>
<j:if test="${sourcesPresent}">
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<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>
<j:if test="${sourcesPresent or !pom.build.resources.isEmpty()}">
<buildSpec>
<util:tokenize var="commands" delim=",">${fullbuildcommands}</util:tokenize>
<j:forEach var="command" items="${commands}" trim="true">
<buildCommand>
<name>${command}</name>
<arguments></arguments>
</buildCommand>
</j:forEach>
</buildSpec>
<natures>
<util:tokenize var="natures" delim=",">${fullprojectnatures}</util:tokenize>
<j:forEach var="nature" items="${natures}" trim="true">
<nature>${nature}</nature>
</j:forEach>
</natures>
</j:if>
</projectDescription>

View File

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
/*
* Copyright 2001-2005 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.
*/
-->
<j:whitespace xmlns:j="jelly:core" xmlns:maven="jelly:maven" xmlns:u="jelly:util" xmlns:eclipse="eclipse" xmlns="dummy" trim="true">
<project-modules id="moduleCoreId">
<j:set var="deployDir" value="/" />
<j:set var="moduletype" value="jst.utility" />
<j:set var="deployname" value="${pom.artifactId}" />
<j:set var="mmpt" value="${maven.multiproject.type}" trim="true" />
<j:choose>
<j:when test="${mmpt == 'war'}">
<!-- war -->
<j:set var="moduletype" value="jst.web" />
<j:set var="deployDir" value="/WEB-INF/classes" />
</j:when>
</j:choose>
<wb-module deploy-name="${deployname}">
<j:choose>
<j:when test="${moduletype == 'jst.web'}">
<!-- war -->
<maven:get var="warPath" plugin='maven-war-plugin' property='maven.war.src' />
<maven:makeRelativePath var="relWarPath" basedir="${basedir}" path="${warPath}" separator="/" />
<module-type module-type-id="jst.web">
<version>
<!-- try to detect servlet dependency, maven.eclipse.servletapilist can hold different names -->
<j:set var="moduleversion" value="x" />
<u:tokenize var="servletapilist" delim=",">${maven.eclipse.servletapilist}</u:tokenize>
<j:forEach var="servletapi" items="${servletapilist}" trim="true">
<j:if test="${pom.getDependency(servletapi) != null}">
<j:set var="moduleversion" value="${pom.getDependency(servletapi).getVersion()}" />
</j:if>
</j:forEach>
<!-- defaults to 2.2 -->
<j:choose>
<j:when test="${moduleversion.startsWith('2.4')}">2.4</j:when>
<j:when test="${moduleversion.startsWith('2.3')}">2.3</j:when>
<j:otherwise>2.2</j:otherwise>
</j:choose>
</version>
<property name="context-root" value="${pom.artifactId}" />
</module-type>
<wb-resource deploy-path="/" source-path="/${relWarPath}" />
</j:when>
<j:otherwise>
<!-- jar -->
<module-type module-type-id="jst.utility" />
</j:otherwise>
</j:choose>
<j:set var="srcDir" value="" />
<!-- main src dir -->
<j:if test="${sourcesPresent}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" separator="/" />
<wb-resource deploy-path="${deployDir}" source-path="/${srcDir}" />
</j:if>
<!-- resources -->
<j:if test="${maven.eclipse.resources.addtoclasspath}">
<j:if test="${!pom.build.resources.isEmpty()}">
<j:forEach var="resource" items="${pom.build.resources}">
<maven:makeRelativePath var="resourceDirectory" basedir="${basedir}" path="${resource.directory}" separator="/" />
<!-- don't add duplicate directories -->
<j:if test="${!resourceDirectory.equals(srcDir)}">
<wb-resource deploy-path="${deployDir}" source-path="/${resourceDirectory}" />
</j:if>
</j:forEach>
</j:if>
</j:if>
<!-- generated source directories -->
<u:available file="${maven.gen.src}">
<u:file var="genSrcRootDir" name="${maven.gen.src}" />
<j:forEach var="genSrcDir" items="${genSrcRootDir.listFiles()}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${genSrcDir}" separator="/" />
<wb-resource deploy-path="${deployDir}" source-path="/${srcDir}" />
</j:forEach>
</u:available>
<j:if test="${moduletype == 'jst.web'}">
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="eclipseDependency" value="${lib.dependency.getProperty('eclipse.dependency')}" />
<j:choose>
<j:when test="${eclipseDependency == 'true'}">
<dependent-module deploy-path="/WEB-INF/lib"
handle="module:/resource/${lib.dependency.artifactId}/${lib.dependency.artifactId}">
<dependency-type>uses</dependency-type>
</dependent-module>
</j:when>
<j:otherwise>
<!-- make sure it's a webapp library -->
<j:if test="${lib.dependency.getProperty('war.bundle')=='true'}">
<maven:makeRelativePath var="relativePath" basedir="${maven.repo.local}" path="${lib.path}" separator="/" />
<u:file var="checkExist" name="${maven.repo.local}/${relativePath}" />
<j:choose>
<j:when test="${checkExist.exists()}">
<j:set var="relativePathCheck" value="${relativePath}X" />
<j:if test='${relativePathCheck == "X"}'>
<j:set var="relativePath"
value="${lib.dependency.groupId}/jars/${lib.dependency.artifactId}-${lib.dependency.version}.jar" />
</j:if>
<dependent-module deploy-path="/WEB-INF/lib"
handle="module:/classpath/var/MAVEN_REPO/${relativePath}">
<dependency-type>uses</dependency-type>
</dependent-module>
</j:when>
<j:otherwise>
<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/lib/${lib.path}">
<dependency-type>uses</dependency-type>
</dependent-module>
</j:otherwise>
</j:choose>
</j:if>
</j:otherwise>
</j:choose>
</j:forEach>
</j:if>
</wb-module>
</project-modules>
</j:whitespace>

View File

@ -0,0 +1,66 @@
<!--
/*
* 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:assert="assert"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml">
<goal name="testPlugin" prereqs="test-duplicatednatures,test-duplicatedbuilders">
</goal>
<goal name="test-init">
<j:set var="dotProject" value="${basedir}/.project"/>
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
<attainGoal name="eclipse:clean"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotProject}" />
<assert:assertFileExists file="${dotClasspath}" />
</goal>
<goal name="test-duplicatednatures" prereqs="test-init">
<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="${3}" value="${size(natures)}" msg="Wrong number of natures generated"/>
<assert:assertEquals expected="org.eclipse.jst.j2ee.web.WebNature" value="${natures[0].text}" msg="Nature 0 is not what expected"/>
<assert:assertEquals expected="org.eclipse.jdt.core.javanature" value="${natures[1].text}" msg="Nature 1 is not what expected"/>
<assert:assertEquals expected="org.eclipse.wst.common.modulecore.ModuleCoreNature" value="${natures[2].text}" msg="Nature 2 is not what expected"/>
</goal>
<goal name="test-duplicatedbuilders" prereqs="test-init">
<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="${3}" value="${size(builders)}" msg="Wrong number of builders generated"/>
<assert:assertEquals expected="org.eclipse.wst.common.modulecore.ComponentStructuralBuilder" value="${builders[0].text}" msg="Builder 0 is not what expected"/>
<assert:assertEquals expected="org.eclipse.jdt.core.javabuilder" value="${builders[1].text}" msg="Builder 0 is not what expected"/>
<assert:assertEquals expected="org.eclipse.jst.j2ee.web.LibDirBuilder" value="${builders[2].text}" msg="Builder 0 is not what expected"/>
</goal>
</project>

View File

@ -0,0 +1,3 @@
maven.eclipse.resources.addtoclasspath=true
maven.eclipse.projectnatures=org.eclipse.jst.j2ee.web.WebNature,org.eclipse.jdt.core.javanature,org.eclipse.wst.common.modulecore.ModuleCoreNature
maven.eclipse.buildcommands=org.eclipse.wst.common.modulecore.ComponentStructuralBuilder,org.eclipse.jdt.core.javabuilder,org.eclipse.jst.j2ee.web.LibDirBuilder

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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>
<extend>${basedir}/../project.xml</extend>
<id>test-maven-eclipse-duplicatebuilderstest-plugin</id>
<name>Test project for Maven Eclipse Plugin (duplicate builders)</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/TestAll.java</include>
</includes>
<resources>
<resource>
<directory>src/test-resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main</directory>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>src/main</directory>
</resource>
<resource>
<directory>src/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/test</directory>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1 @@
needed for plugin test

View File

@ -0,0 +1,86 @@
<!--
/*
* 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:assert="assert"
xmlns:ant="jelly:ant"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml">
<goal name="testPlugin" prereqs="test-default, test-classpath, test-project">
</goal>
<goal name="test-init">
<j:set var="dotProject" value="${basedir}/.project"/>
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
<attainGoal name="eclipse:clean"/>
</goal>
<goal name="test-default">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.resources.addtoclasspath" value="true"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotClasspath}" />
<assert:assertFileExists file="${dotProject}" />
</goal>
<goal name="test-classpath">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.resources.addtoclasspath" value="true"/>
<attainGoal name="eclipse:generate-classpath"/>
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="countResources" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/main/resources')])"/>
<assert:assertEquals expected="1" value="${countResources.intValue().toString()}" msg="resources entry not found"/>
<x:set var="countNoresources" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/main/noresources')])"/>
<assert:assertEquals expected="0" value="${countNoresources.intValue().toString()}" msg="noresources entry found"/>
<x:set var="countSources" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/main/java')])"/>
<assert:assertEquals expected="0" value="${countSources.intValue().toString()}" msg="sources entry found"/>
</goal>
<goal name="test-project">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.resources.addtoclasspath" value="true"/>
<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="countNatures" select="count($natures)"/>
<assert:assertEquals expected="1" value="${countNatures.intValue().toString()}" msg="expected 1 nature"/>
<assert:assertEquals expected="org.eclipse.jdt.core.javanature" value="${natures[0].text}" msg="expected the nature to be the java one"/>
<x:set var="builders" select="$projectDoc/projectDescription/buildSpec/buildCommand/name"/>
<x:set var="countBuilders" select="count($builders)"/>
<assert:assertEquals expected="1" value="${countBuilders.intValue().toString()}" msg="expected 1 builder"/>
<assert:assertEquals expected="org.eclipse.jdt.core.javabuilder" value="${builders[0].text}" msg="expected the builder to be the java one"/>
</goal>
</project>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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>
<extend>${basedir}/../project.xml</extend>
<id>test-maven-eclipse-nosourcetest-plugin</id>
<name>Test project for Maven Eclipse Plugin (resources only)</name>
<dependencies>
<dependency>
<id>maven</id>
<version>beta-8</version>
<jar>maven.jar</jar>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/noresources</directory>
<includes>
<include>**/*.properties</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1 @@
avalue=somevalue

View File

@ -1,13 +1,13 @@
<!--
<!--
/*
* 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.
@ -15,39 +15,39 @@
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core"
xmlns:assert="assert"
<project xmlns:j="jelly:core"
xmlns:assert="assert"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml">
<goal name="testPlugin" prereqs="test-eclipse,test-natures,test-builders,test-natures-and-builders,test-classpath-has-generated-source,test-classpath-has-overridden-jar,test-noduplicates,test-classpath-con-entry,test-classpath-no-resources">
<goal name="testPlugin" prereqs="test-eclipse,test-natures,test-builders,test-natures-and-builders,test-classpath-has-generated-source,test-classpath-has-overridden-jar,test-noduplicates,test-classpath-con-entry,test-classpath-no-resources,MPECLIPSE-96,MPECLIPSE-92">
</goal>
<goal name="test-init">
<j:set var="dotProject" value="${basedir}/.project"/>
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
<attainGoal name="eclipse:clean"/>
</goal>
<goal name="test-eclipse">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotProject}" />
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="countJUnit" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/junit/jars/junit-3.8.1.jar')])"/>
<assert:assertEquals expected="1" value="${countJUnit.intValue().toString()}" msg="JUnit dependency not found"/>
<x:set var="countCactus" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/cactus/jars/cactus-13-1.6.1.jar')])"/>
<assert:assertEquals expected="1" value="${countCactus.intValue().toString()}" msg="Only one Cactus dependency should be found"/>
<x:set var="countJUnit" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/junit/jars/junit-3.8.1.jar')])"/>
<assert:assertEquals expected="1" value="${countJUnit.intValue().toString()}" msg="JUnit dependency not found"/>
<x:set var="countCactus" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/cactus/jars/cactus-13-1.6.1.jar')])"/>
<assert:assertEquals expected="1" value="${countCactus.intValue().toString()}" msg="Only one Cactus dependency should be found"/>
</goal>
<goal name="test-natures">
<attainGoal name="test-init"/>
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.projectnatures" value="n1,a.b.c.n2"/>
<attainGoal name="eclipse:generate-project"/>
@ -61,11 +61,11 @@
</goal>
<goal name="test-builders">
<attainGoal name="test-init"/>
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.buildcommands" value="c1,c2,c3"/>
<attainGoal name="eclipse:generate-project"/>
<assert:assertFileExists file="${dotProject}" />
<u:file var="projectFile" name="${dotProject}"/>
<x:parse var="projectDoc" xml="${projectFile.toURL()}" />
@ -103,7 +103,7 @@
<goal name="test-classpath-has-generated-source">
<attainGoal name="test-init"/>
<mkdir dir="${maven.gen.src}/gensrc1"/>
<mkdir dir="${maven.gen.src}/gensrc2"/>
<mkdir dir="${maven.gen.src}/gensrc2"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotProject}" />
@ -124,8 +124,8 @@
<j:set var="cactusStatus" value="installed"/>
</j:if>
<echo>Cactus plugin ${cactusStatus} - expecting ${expectedDirs} source entries.</echo>
<assert:assertEquals expected="${expectedDirs}" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
<assert:assertEquals expected="${expectedDirs}" value="${count.intValue().toString()}" msg="Wrong number of generated src directories found"/>
</goal>
<goal name="test-classpath-has-overridden-jar">
@ -137,39 +137,39 @@
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/maven/jars/maven.jar')])"/>
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="override by jar tag not found"/>
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="override by jar tag not found"/>
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar')])"/>
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="maven.jar.override didn't work"/>
<assert:assertEquals expected="1" value="${count.intValue().toString()}" msg="maven.jar.override didn't work"/>
</goal>
<goal name="test-noduplicates">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="countUniqueSrc" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/main')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrc.intValue().toString()}" msg="Src directory should be added only once"/>
<x:set var="countUniqueSrcTest" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/test')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrcTest.intValue().toString()}" msg="Test directory should be added only once"/>
<x:set var="countUniqueSrc" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/main')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrc.intValue().toString()}" msg="Src directory should be added only once"/>
<x:set var="countUniqueSrcTest" select="count($classpathDoc/classpath/classpathentry[ends-with(@path,'src/test')])"/>
<assert:assertEquals expected="1" value="${countUniqueSrcTest.intValue().toString()}" msg="Test directory should be added only once"/>
</goal>
<goal name="test-classpath-con-entry">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.conclasspath" value="org.eclipse.pde.core.requiredPlugins"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="countConEntries" select="count($classpathDoc/classpath/classpathentry[contains(@kind,'con')])"/>
<assert:assertEquals expected="2" value="${countConEntries.intValue().toString()}" msg="Classpath entry kind='con' should be added twice, once mandatory, other variable"/>
</goal>
<x:set var="countConEntries" select="count($classpathDoc/classpath/classpathentry[contains(@kind,'con')])"/>
<assert:assertEquals expected="2" value="${countConEntries.intValue().toString()}" msg="Classpath entry kind='con' should be added twice, once mandatory, other variable"/>
</goal>
<goal name="test-classpath-no-resources">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.resources.addtoclasspath" value="false"/>
@ -180,11 +180,43 @@
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/resources')])"/>
<assert:assertEquals expected="0" value="${count.intValue().toString()}" msg="The src/resources dir should not be imported"/>
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/resources')])"/>
<assert:assertEquals expected="0" value="${count.intValue().toString()}" msg="The src/resources dir should not be imported"/>
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/test-resources')])"/>
<assert:assertEquals expected="0" value="${count.intValue().toString()}" msg="The src/test-resources dir should not be imported"/>
</goal>
<x:set var="count" select="count($classpathDoc/classpath/classpathentry[contains(@path,'src/test-resources')])"/>
<assert:assertEquals expected="0" value="${count.intValue().toString()}" msg="The src/test-resources dir should not be imported"/>
</goal>
<goal name="MPECLIPSE-96">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.resources.addtoclasspath" value="true"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="including" select="$classpathDoc/classpath/classpathentry[contains(@path,'src/resources')]/@including"/>
<x:set var="excluding" select="$classpathDoc/classpath/classpathentry[contains(@path,'src/resources')]/@excluding"/>
<assert:assertEquals expected="**/*.properties|**/*.xml" value="${including[0].value}" msg="Including is not set correctly"/>
<assert:assertEquals expected="**/*.log|**/*.txt" value="${excluding[0].value}" msg="Excluding is not set correctly"/>
</goal>
<goal name="MPECLIPSE-92">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.output.dir" value="web-content/WEB-INF/classes"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotClasspath}" />
<u:file var="classpathFile" name="${dotClasspath}"/>
<x:parse var="classpathDoc" xml="${classpathFile.toURL()}" />
<x:set var="path" select="$classpathDoc/classpath/classpathentry[@kind = 'output']/@path"/>
<assert:assertEquals expected="web-content/WEB-INF/classes" value="${path[0].value}" msg="Output path not set correctly"/>
</goal>
</project>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
/*
* 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.
@ -21,7 +21,7 @@
<project>
<pomVersion>3</pomVersion>
<extend>${basedir}/../project.xml</extend>
<id>test-maven-eclipse-maintest-plugin</id>
<id>test-maven-eclipse-maintest-plugin (main)</id>
<name>Test project for Maven Eclipse Plugin</name>
<dependencies>
@ -31,10 +31,10 @@
<version>1.0.3</version>
<type>jar</type>
<properties/>
</dependency>
</dependency>
<dependency>
<id>maven</id>
<version>beta-8</version>
<version>1.0.2</version>
<jar>maven.jar</jar>
</dependency>
<dependency>
@ -46,12 +46,12 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependency>
<dependency>
<groupId>cactus</groupId>
<artifactId>cactus</artifactId>
<version>13-1.6.1</version>
</dependency>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
@ -80,6 +80,10 @@
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<excludes>
<exclude>**/*.log</exclude>
<exclude>**/*.txt</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>

View File

@ -0,0 +1 @@
needed for plugin test

View File

@ -0,0 +1 @@
needed for plugin test

View File

@ -1,13 +1,13 @@
<!--
<!--
/*
* 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.
@ -15,8 +15,8 @@
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core"
xmlns:assert="assert"
<project xmlns:j="jelly:core"
xmlns:assert="assert"
xmlns:ant="jelly:ant"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
@ -24,13 +24,13 @@
<goal name="testPlugin" prereqs="test-classpath, test-project">
</goal>
<goal name="test-init">
<j:set var="dotProject" value="${basedir}/.project"/>
<j:set var="dotClasspath" value="${basedir}/.classpath"/>
<attainGoal name="eclipse:clean"/>
</goal>
<goal name="test-classpath">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
@ -39,24 +39,25 @@
</u:available>
<j:if test="${classpathFound}">
<ant:fail>The classpath file was created, and shouldn't have been.</ant:fail>
</j:if>
</j:if>
</goal>
<goal name="test-project">
<attainGoal name="test-init"/>
<attainGoal name="test-init"/>
<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="countBuilder" select="count($projectDoc/projectDescription/buildSpec/buildCommand/name)"/>
<assert:assertEquals expected="0" value="${countBuilder.intValue().toString()}" msg="Shouldn't find any builders."/>
</goal>
<x:set var="countNatures" select="count($projectDoc/projectDescription/natures/nature)"/>
<x:set var="countBuilder" select="count($projectDoc/projectDescription/buildSpec/buildCommand/name)"/>
<assert:assertEquals expected="${0}" value="${countBuilder.intValue()}" msg="Shouldn't find any builders."/>
<assert:assertEquals expected="${0}" value="${countNatures.intValue()}" msg="Shouldn't find any natures."/>
</goal>
</project>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
/*
* 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.
@ -22,24 +22,14 @@
<pomVersion>3</pomVersion>
<extend>${basedir}/../project.xml</extend>
<id>test-maven-eclipse-nosourcetest-plugin</id>
<name>Test project for Maven Eclipse Plugin</name>
<name>Test project for Maven Eclipse Plugin (nosource)</name>
<dependencies>
<dependency>
<id>maven</id>
<version>beta-8</version>
<jar>maven.jar</jar>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>

View File

@ -0,0 +1,59 @@
<!--
/*
* 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:assert="assert"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
xmlns:x="jelly:xml"
xmlns:ant="jelly:ant">
<goal name="testPlugin" prereqs="test-defaultgoal,test-wtpmodules,test-nowtpmodules">
</goal>
<goal name="test-init">
<j:set var="dotWtpmodules" value="${basedir}/.wtpmodules"/>
<attainGoal name="eclipse:clean"/>
</goal>
<goal name="test-defaultgoal">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
</goal>
<goal name="test-nowtpmodules">
<attainGoal name="test-init"/>
<j:set var="maven.eclipse.projectnatures" value="" />
<attainGoal name="eclipse" />
<u:available file="${dotWtpmodules}">
<ant:fail>The .wtpmodules file was created, and shouldn't have been.</ant:fail>
</u:available>
</goal>
<goal name="test-wtpmodules">
<attainGoal name="test-init"/>
<attainGoal name="eclipse"/>
<assert:assertFileExists file="${dotWtpmodules}" />
<u:file var="wtpmodulesFile" name="${dotWtpmodules}"/>
<x:parse var="wtpmodulesDoc" xml="${wtpmodulesFile.toURL()}" />
</goal>
</project>

View File

@ -0,0 +1,6 @@
maven.eclipse.resources.addtoclasspath=true
maven.multiproject.type=war
maven.eclipse.projectnatures=org.eclipse.jdt.core.javanature,org.eclipse.wst.common.modulecore.ModuleCoreNature
maven.eclipse.buildcommands=org.eclipse.wst.common.modulecore.ComponentStructuralBuilder,org.eclipse.jdt.core.javabuilder,org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver
maven.eclipse.conclasspath=org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v5.5,org.eclipse.jst.j2ee.internal.web.container/wtptest

View File

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* 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>
<extend>${basedir}/../project.xml</extend>
<id>test-maven-eclipse-wtptest-plugin</id>
<name>Test project for Maven Eclipse Plugin (wtp)</name>
<dependencies>
<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-servlet</artifactId>
<version>2.4-rc4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/TestAll.java</include>
</includes>
<resources>
<resource>
<directory>src/test-resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main</directory>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>src/main</directory>
</resource>
<resource>
<directory>src/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1 @@
needed for plugin test

View File

@ -0,0 +1 @@
needed for plugin test

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
/*
* 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.
@ -24,13 +24,27 @@
<author email="dion@multitask.com.au">dIon Gillard</author>
</properties>
<body>
<release version="1.10" date="IN CVS">
<release version="1.10" date="IN SVN">
<action dev="carlos" type="fix">Moved test classpath before main so test classpath resources override main ones</action>
<action dev="epugh" type="fix" issue="MPECLIPSE-68">eclipse:add-maven-repo doesn't update correct Eclipse property file for Eclipse 3.x</action>
<action dev="epugh" type="fix" issue="MPECLIPSE-67">add-maven-repo fails if Eclipse hasn't been started yet. Property file needs to be created
by the plugin.</action>
by the plugin.
</action>
<action dev="epugh" type="fix" issue="MPECLIPSE-56" due-to="Archimedes Trajano">Only create .classpath and javabuilder if sources are present</action>
</release>
<action dev="fgiust" type="fix" issue="MPECLIPSE-78" due-to="Fabrizio Giustina">Don't add duplicate java natures/builders if already specified using
<code>maven.eclipse.projectnatures</code> and <code>maven.eclipse.buildcommands</code>
</action>
<action dev="fgiust" type="fix" issue="MPECLIPSE-63" due-to="Fabrizio Giustina">Only add javanature if sources are present</action>
<action dev="fgiust" type="add" issue="MPECLIPSE-80" due-to="Fabrizio Giustina">Generates a .wtpmodules file for eclipse webtools (wtp 0.7 required)</action>
<action dev="fgiust" type="fix" issue="MPECLIPSE-96" due-to="Fabrizio Giustina">classpathentry contains trailing pipe character that confuses Eclipse 3.1</action>
<action dev="fgiust" type="update" due-to="Fabrizio Giustina">Java source location now defaults to
<code>MAVEN_REPO${groupId}/java-sources/${artifactId}-${version}-sources.jar</code> (standard location where source artifacts are deployed by the m2 source plugin in
a legacy/m1 repository layout). The path <code>${groupId}/src/${artifactId}-${version}.${maven.eclipse.src.extension}</code> is still supported for backward compatibility
and it will be used only if a file already exists at that location.
</action>
<action dev="fgiust" type="fix" issue="MPECLIPSE-92" due-to="Yang Li">Setting relative path value to "maven.eclipse.output.dir" generates wrong absolute classpath entry</action>
<action dev="fgiust" type="fix" issue="MPECLIPSE-72" due-to="Kristopher Brown">Failing use cases for projects with just resources</action>
</release>
<release version="1.9" date="2004-10-30">
<action dev="epugh" type="fix" issue="MPECLIPSE-53">Add property
<code>maven.eclipse.resources.addtoclasspath</code>to control whether to add pom.resources etc or not. Provide backwards compatiblity.
@ -78,7 +92,7 @@
<release version="1.3" date="Unknown">
<action dev="michal" type="add">Smarter generation of .classpath file. ${basedir} prefix is cut off if present in any path. Default Maven location of source and destination folder are used.</action>
<action dev="evenisse" type="add">Added dependency functionality between projects</action>
<action dev="bwalding" type="update">Split eclispe goal in two goals : eclipse:generate-project and eclipse:generate-classpath</action>
<action dev="bwalding" type="update">Split eclipse goal in two goals : eclipse:generate-project and eclipse:generate-classpath</action>
</release>
<release version="1.2" date="Unknown">
<action dev="dion" type="add">Added more documentation</action>

View File

@ -1,14 +1,14 @@
<?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.
@ -29,19 +29,21 @@
<goal>
<name>eclipse</name>
<description>
The default goal. This goal simply executes the
The default goal. This goal simply executes the
<a href="#eclipse:generate-project">eclipse:generate-project</a> and
<a href="#eclipse:generate-classpath">eclipse:generate-classpath</a> goals.
If the <code>maven.multiproject.type</code> is set to <code>war</code> also calls the
<a href="#eclipse:generate-wtpmodules">eclipse:generate-wtpmodules</a> goal.
</description>
</goal>
<goal>
<name>eclipse:clean</name>
<description>
Deletes the <code>.project</code> and <code>.classpath</code> files.
Deletes the <code>.project</code>, <code>.classpath</code> and <code>.wtpmodules</code> files.
</description>
</goal>
</goal>
<goal>
<name>eclipse:generate-project</name>
<description>
@ -61,14 +63,22 @@
<li>the JRE being used</li>
<li>the appropriate version of JUnit</li>
<li>each Maven project <code>dependency</code></li>
<li>an output directory for compiled code:
<li>an output directory for compiled code:
<code>target\classes</code>
</li>
<li>any .zip source archives</li>
</ol>
</description>
</goal>
<goal>
<name>eclipse:generate-wtpmodules</name>
<description>
Generates a <code>.wtpmodules</code> file for eclipse wtp marking the project as a j2ee module.
Project with the <code>maven.multiproject.type</code> set to <code>war</code> are configured as web modules.
</description>
</goal>
<goal>
<name>eclipse:external-tools</name>
<description>

View File

@ -1,14 +1,14 @@
<?xml version="1.0"?>
<!--
<!--
/*
* 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.
@ -32,7 +32,7 @@
(<code>.classpath</code> and <code>.project</code> files), as well as
configure Eclipse to use Maven as an <i>External Tool</i>.
</p>
<p>
<p>
For more information on the functionality provided by this plugin,
please see the <a href="goals.html">Goals</a> document.
</p>
@ -42,11 +42,11 @@
document.
</p>
</section>
<section name="Defining dependencies as eclipse projects">
<p>
The dependencies defined in the POM need not to be jars strictly. They can
be projects in the eclipse workspace. If a dependency is an eclipse project
The dependencies defined in the POM need not to be jars strictly. They can
be projects in the eclipse workspace. If a dependency is an eclipse project
a property needs to be added to that dependency to indicate so.
</p>
<source><![CDATA[
@ -60,7 +60,7 @@
</dependency>
]]></source>
<p>
This indicates that the dependency is another project in the workspace.
This indicates that the dependency is another project in the workspace.
Note that the name of the referenced project is the artifactId.
</p>
<p>
@ -74,23 +74,20 @@
Frequently you will want to include for compiled jars the source .java files to help
with debugging.
</p>
<p>
The plugin will check if the file specified is located in <code>MAVEN_REPO/${groupId}/src/</code> directory
and ending in <code>maven.eclipse.src.extension</code> exists and will add it as a source attachment.
Using default values the dependency <code>MAVEN_REPO/eclipse/<em>jars</em>/eclipse-ui-3.0.0.<em>jar</em></code>
will be mapped to <code>MAVEN_REPO/eclipse/<em>src</em>/eclipse-ui-3.0.0.<em>zip</em></code>
<p>
The plugin will check if the file located at <code>MAVEN_REPO${groupId}/java-sources/${artifactId}-${version}-sources.jar</code>
exists and will add it as a source attachment.
As an example, the source archive for the dependency <code>MAVEN_REPO/eclipse/<em>jars</em>/eclipse-ui-3.0.0<em>.jar</em></code>
will be mapped to <code>MAVEN_REPO/eclipse/<em>java-sources</em>/eclipse-ui-3.0.0<em>-sources.jar</em></code>
</p>
<p>
While this implementation isn't the perfect solution, for example no downloading of
source .zip files, it is a minimal solution that will work now. Future versions
of Maven will have more sophisticated solutions for dealing with source code. There is
no guarantee that this implementation will remain in later versions of Maven and this
plugin.
For backward compatibility the plugin still accepts source archives located at
<code>MAVEN_REPO/${groupId}/src/${artifactId}-${version}.${maven.eclipse.src.extension}</code>.
</p>
</subsection>
<subsection name="Generated Source Code">
<p>
When Eclipse is not generating source code for you there is a conflict between
When Eclipse is not generating source code for you there is a conflict between
Maven generating the source code and then Eclipse treating it as compiled code.
Typically when generating code using Maven the code ends up in the target/classes
directory. This is fine as long as Maven is doing the build. However, if Eclipse
@ -101,15 +98,15 @@
The alternatives typically are to place the generated code in the /src/java directory
and allow Maven and Eclipse to treat it the same. However, this leads to a tendency
to check generated code into source control, which typically is not appropriate for
generated code. Alternatively, it can be placed in some sort of /src/generated or
target/generated directory. In Maven2, generated code lives in target/generated-sources,
generated code. Alternatively, it can be placed in some sort of /src/generated or
target/generated directory. In Maven2, generated code lives in target/generated-sources,
in a manner similiar to generated xdoc's live in target/generated-xdocs. Within the
target/generated-sources would be each type of generated code.
target/generated-sources would be each type of generated code.
</p>
<p>
By default, the plugin will load as seperate source folders any directory found in
<code>${maven.build.dir}/generated-sources</code>. So, if you generate your mock objects into
<code>${maven.build.dir}/generated-sources/mocks</code> and your wsdl classes into
<code>${maven.build.dir}/generated-sources/mocks</code> and your wsdl classes into
<code>${maven.build.dir}/generated-sources/wsdl</code> then each of these directories will be mounted
as source folders. Note: You must have already created these directories, otherwise the
plugin won't know to add them as source folders. Before running <code>maven eclipse</code>
@ -117,7 +114,7 @@
</p>
<p>
For example, if you used the XDoclet Plugin for Maven to generate Hibernate mapping files,
they would be placed in <code>/target/generated-sources/xdoclet/</code>. While, if you used the
they would be placed in <code>/target/generated-sources/xdoclet/</code>. While, if you used the
Hibernate Plugin for Maven to generate the SQL scripts for generating a database then that
would be placed in <code>/target/generated-sources/schema/</code>.
<br/>
@ -128,6 +125,6 @@ maven.xdoclet.hibernatedoclet.destDir=${maven.build.dir}/generated-sources/xdocl
maven.hibernate.output.dir=${maven.build.dir}/generated-sources/schema
</source>
</subsection>
</section>
</section>
</body>
</document>

View File

@ -1,14 +1,14 @@
<?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.
@ -38,7 +38,7 @@
<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
eclipse into <code>c:\eclipse</code>, the workspace is
<code>c:\eclipse\workspace</code>.
</p>
<p>
@ -52,7 +52,7 @@
<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
property is set to <code>none</code> then JUnit will not be added to your
build classpath.
</td>
</tr>
@ -77,7 +77,7 @@
<td>maven.eclipse.classpath.include</td>
<td>Yes</td>
<td>
Comma delimited list of additional source directories to include in
Comma delimited list of additional source directories to include in
the classpath, like <code>src/conf</code>.
</td>
</tr>
@ -88,13 +88,13 @@
Specify whether to include the resources defined in the POM in the
Eclipse classpath. Defaults to false.
</td>
</tr>
</tr>
<tr>
<td>maven.eclipse.conclasspath</td>
<td>Yes</td>
<td>
Comma delimited list of additional kind "con" path
to include in the classpath description file like
Comma delimited list of additional kind "con" path
to include in the classpath description file like
<code>org.eclipse.pde.core.requiredPlugins</code>
</td>
</tr>
@ -102,8 +102,9 @@
<td>maven.eclipse.buildcommands</td>
<td>Yes</td>
<td>
Comma delimited list of additional build commands
to include in the project description file.
Comma delimited list of additional build commands
to include in the project description file. The java builder will automatically be added if a java source
dir is set (if not already specified in the list).
</td>
</tr>
<tr>
@ -112,7 +113,7 @@
<td>
Comma delimited list of additional project natures
to include in the project description file. These natures
will be added after the java nature.
will be added after the java nature (if the java nature is not already specified in the list).
</td>
</tr>
<tr>
@ -130,14 +131,16 @@
<td>Yes (default=<code>zip</code>)</td>
<td>
The extension used for source attachments.
Deprecated, source attachment are expected now at
<code>MAVEN_REPO${groupId}/java-sources/${artifactId}-${version}-sources.jar</code>
</td>
</tr>
</table>
<p>
Note that you will need to defined a <code>MAVEN_REPO</code> Java
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
then Classpath Variables. Create a new variable named
<code>MAVEN_REPO</code> that points to your local Maven repository.
</p>
</section>