Files
maven-plugins/eclipse/src/plugin-resources/templates/classpath.jelly
T
2003-10-29 18:40:06 +00:00

117 lines
4.7 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<j:whitespace
xmlns:j="jelly:core"
xmlns:util="jelly:util"
xmlns:ant="jelly:ant"
xmlns:maven="jelly:maven"
xmlns:u="jelly:util"
xmlns="dummy"
trim="true">
<classpath>
<j:if test="${sourcesPresent}">
<maven:makeRelativePath var="srcDir" basedir="${basedir}" path="${pom.build.sourceDirectory}"/>
<classpathentry kind="src" path="${srcDir}"/>
</j:if>
<j:if test="${unitTestSourcesPresent}">
<ant:echo>Contains JUnit tests</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${pom.build.unitTestSourceDirectory}"/>
<!-- Eclipse supports an output directory per input directory -->
<j:set var="testOutputDir" value="${maven.eclipse.test.output.dir}"/>
<j:if test="${empty testOutputDir}">
<maven:pluginVar var="testOutputDir" plugin='maven-test-plugin' property='maven.test.dest'/>
</j:if>
<maven:makeRelativePath var="testOutputDir" basedir="${basedir}" path="${testOutputDir}" />
<ant:echo>Setting compile of ${testSrcDir} to ${testOutputDir}</ant:echo>
<classpathentry kind="src" path="${testSrcDir}" output="${testOutputDir}"/>
<!-- split the list of additional directories for the classpath -->
<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}">
<classpathentry kind="src" path="${res}"/>
</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:pluginVar 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'}">
<classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-${depVersion}.jar"/>
</j:if>
</j:if>
<maven:pluginVar var="cactusSrcDir" plugin='maven-cactus-plugin' property='cactus.src.dir' />
<util:available file="${cactusSrcDir}">
<j:set var="cactusSourcePresent" value="true"/>
</util:available>
<j:if test="${cactusSourcePresent == 'true'}">
<ant:echo>Contains Cactus Tests!</ant:echo>
<maven:makeRelativePath var="testSrcDir" basedir="${basedir}" path="${cactusSrcDir}" />
<classpathentry kind="src" path="${testSrcDir}"/>
<maven:pluginVar var="cactusPlugin" plugin='maven-cactus-plugin' property='plugin' />
<j:set var="depVersion">${cactusPlugin.getDependency('cactus').getVersion()}</j:set>
<classpathentry kind="var" path="MAVEN_REPO/cactus/jars/cactus-${depVersion}.jar"/>
</j:if>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
<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="${lib.dependency.groupId == 'junit'}">
<!-- 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}">
<classpathentry kind="var" path="MAVEN_REPO${lib.urlPath}"/>
</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}"/>
</j:if>
<maven:makeRelativePath var="outputDir" basedir="${basedir}" path="${outputDir}" />
<classpathentry kind="output" path="${outputDir}"/>
<ant:echo>Setting default output directory to ${outputDir}</ant:echo>
</classpath>
</j:whitespace>