git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@349325 13f79535-47bb-0310-9956-ffa450edef68
254 lines
12 KiB
XML
254 lines
12 KiB
XML
<?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.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
-->
|
|
|
|
<j:whitespace xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:u="jelly:util"
|
|
xmlns:eclipse="eclipse" xmlns="dummy" trim="true">
|
|
<classpath>
|
|
|
|
<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>
|
|
|
|
<j:if test="${sourcesPresent}">
|
|
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}" separator="/" />
|
|
<j:set var="excluding" value="" />
|
|
<j:forEach var="sm" items="${pom.build.sourceModifications}">
|
|
<ant:available property="classPresent" classname="${sm.className}" />
|
|
<j:if test="${classPresent != 'true'}">
|
|
<j:forEach var="exclude" items="${sm.excludes}">
|
|
<j:choose>
|
|
<j:when test="${excluding.length() == 0}">
|
|
<j:set var="excluding" value="${exclude}" />
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:set var="excluding" value="${excluding}|${exclude}" />
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:forEach>
|
|
</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}" />
|
|
|
|
<!-- 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.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:if test="${includingAsString.length() > 0}">
|
|
<j:set var="includingAsString" value="${includingAsString}|" />
|
|
</j:if>
|
|
<j:set var="includingAsString" value="${includingAsString}${res}" />
|
|
</j:forEach>
|
|
<j:set var="excludingAsString" value="" />
|
|
<j:forEach var="res" items="${resource.excludes}">
|
|
<j:if test="${excludingAsString.length() > 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="${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>
|
|
|
|
<!-- add extra directories to be included in the classpath -->
|
|
<j:forEach var="res" items="${maven.eclipse.classpath.include.split}">
|
|
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${res}" separator="/" />
|
|
<classpathentry kind="src" path="${srcDir}" />
|
|
</j:forEach>
|
|
|
|
<maven:get var="cactusSrcDir" plugin='cactus-maven' property='cactus.src.dir' />
|
|
<u:available file="${cactusSrcDir}">
|
|
<j:set var="cactusSourcePresent" value="true" />
|
|
</u:available>
|
|
|
|
<j:set var="ignoreCactus" value="false" />
|
|
<j:if test="${cactusSourcePresent == 'true'}">
|
|
<ant:echo>Contains Cactus Tests!</ant:echo>
|
|
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${cactusSrcDir}" separator="/" />
|
|
<classpathentry kind="src" path="${testSrcDir}" />
|
|
|
|
<maven:get var="cactusPlugin" plugin='cactus-maven' property='plugin' />
|
|
<j:set var="depVersion">${cactusPlugin.getDependency('cactus').getVersion()}</j:set>
|
|
<eclipse:write-classpath-entry groupId="cactus" artifactId="cactus" version="${depVersion}" relativePath="" />
|
|
<j:set var="ignoreCactus" value="true" />
|
|
</j:if>
|
|
|
|
<j:forEach var="lib" items="${pom.artifacts}">
|
|
<j:set var="eclipseDependency" value="${lib.dependency.getProperty('eclipse.dependency')}" />
|
|
<j:choose>
|
|
<j:when test="${eclipseDependency == 'true'}">
|
|
<classpathentry kind="src" path="/${lib.dependency.artifactId}" />
|
|
</j:when>
|
|
<j:when test="${eclipseDependency == 'false'}">
|
|
<!-- ignore specific dependencies -->
|
|
</j:when>
|
|
<j:when test="${lib.dependency.groupId == 'junit' and ignoreJUnit}">
|
|
<!-- ignoring junit dependency as we've already created it -->
|
|
</j:when>
|
|
<j:when test="${lib.dependency.groupId == 'cactus' and ignoreCactus}">
|
|
<!-- ignoring junit dependency as we've already created it -->
|
|
</j:when>
|
|
<j:otherwise>
|
|
<!-- make sure it's a classpath dependency -->
|
|
<j:set var="isClasspath" value="${lib.dependency.isAddedToClasspath()}" />
|
|
<j:if test="${isClasspath}">
|
|
<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()}">
|
|
<eclipse:write-classpath-entry groupId="${lib.dependency.groupId}"
|
|
artifactId="${lib.dependency.artifactId}" version="${lib.dependency.version}"
|
|
relativePath="${relativePath}" />
|
|
</j:when>
|
|
<j:otherwise>
|
|
<classpathentry kind="lib" path="${lib.path}" />
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:if>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
</j:forEach>
|
|
|
|
<!-- 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}" />
|
|
<maven:makeRelativePath var="outputDir" basedir="${basedir}" path="${outputDir}" separator="/" />
|
|
</j:if>
|
|
<classpathentry kind="output" path="${outputDir}" />
|
|
<ant:echo>Setting default output directory to ${outputDir}</ant:echo>
|
|
</classpath>
|
|
|
|
</j:whitespace>
|