git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112724 13f79535-47bb-0310-9956-ffa450edef68
143 lines
5.4 KiB
XML
143 lines
5.4 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<project xmlns:j="jelly:core">
|
|
|
|
<!--==================================================================-->
|
|
<!-- Generate Eclipse .project and .classpath files -->
|
|
<!--==================================================================-->
|
|
<goal name="eclipse"
|
|
description="Generate Eclipse project files"
|
|
prereqs="eclipse:generate-project"/>
|
|
|
|
<goal name="eclipse:generate-project"
|
|
description="Generate Eclipse .project and .classpath project files">
|
|
|
|
<echo>Creating ${basedir}/.project ...</echo>
|
|
|
|
<j:file name="${basedir}/.project" prettyPrint="true" xmlns="dummy">
|
|
<projectDescription>
|
|
<name>${pom.artifactId}</name>
|
|
<comment></comment>
|
|
<projects>
|
|
</projects>
|
|
<buildSpec>
|
|
<buildCommand>
|
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
|
<arguments>
|
|
</arguments>
|
|
</buildCommand>
|
|
</buildSpec>
|
|
<natures>
|
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
|
</natures>
|
|
</projectDescription>
|
|
</j:file>
|
|
|
|
<echo>Creating ${basedir}/.classpath ...</echo>
|
|
|
|
<j:file name="${basedir}/.classpath" prettyPrint="true" xmlns="dummy">
|
|
<classpath>
|
|
|
|
<j:if test="${sourcesPresent}">
|
|
<classpathentry kind="src" path="${pom.build.sourceDirectory}"/>
|
|
</j:if>
|
|
|
|
<j:if test="${unitTestSourcesPresent}">
|
|
<classpathentry kind="src" path="${pom.build.unitTestSourceDirectory}"/>
|
|
</j:if>
|
|
|
|
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
|
|
<j:forEach var="lib" items="${pom.artifacts}">
|
|
<classpathentry kind="var" path="MAVEN_REPO${lib.urlPath}"/>
|
|
</j:forEach>
|
|
<classpathentry kind="output" path="target\classes"/>
|
|
</classpath>
|
|
</j:file>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Generate Eclipse mappings for Maven goals -->
|
|
<!--==================================================================-->
|
|
<goal name="eclipse:external-tools"
|
|
description="Generate an Eclipse external tool for each goal">
|
|
<mkdir dir="${maven.build.dir}/eclipse/"/>
|
|
<j:set var="toolFile" value="${maven.build.dir}/eclipse/externaltools.xml" />
|
|
|
|
<echo>Creating ${toolFile}</echo>
|
|
|
|
<j:set var="os" value="${os.name}" />
|
|
<j:set var="windows" value="${os.toLowerCase().indexOf('windows') != '-1'}"/>
|
|
<echo>Adapting the generated file for a ${os} box.</echo>
|
|
|
|
<!-- 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}"/>
|
|
|
|
<j:forEach var="goal" items="${project.goals}">
|
|
|
|
<j:set var="maven.eclipse.generate" value="false"/>
|
|
<j:set var="allGoals" value="${maven.eclipse.goals}" />
|
|
<j:choose>
|
|
<j:when test="${allGoals == 'all'}">
|
|
<j:set var="maven.eclipse.generate" value="true"/>
|
|
</j:when>
|
|
<j:otherwise>
|
|
<j:if test="${goal.name.indexOf(':') == '-1'}">
|
|
<j:set var="maven.eclipse.generate" value="true"/>
|
|
</j:if>
|
|
</j:otherwise>
|
|
</j:choose>
|
|
|
|
<j:if test="${maven.eclipse.generate}">
|
|
<tool>
|
|
<entry key="!{tool_refresh}">$${project}</entry>
|
|
<entry key="!{tool_show_log}">true</entry>
|
|
<entry key="!{tool_loc}">${tool.loc}</entry>
|
|
<entry key="!{tool_args}">-e -p $${resource_loc} ${goal.name}</entry>
|
|
<entry key="!{tool_block}">false</entry>
|
|
<entry key="!{tool_type}">org.eclipse.ui.externaltools.type.program</entry>
|
|
<entry key="!{tool_dir}">$${container_loc}</entry>
|
|
<entry key="!{tool_build_types}"></entry>
|
|
<entry key="!{tool_name}">Maven ${goal.name}</entry>
|
|
</tool>
|
|
</j:if>
|
|
</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/" />
|
|
<copy file="${toolFile}" todir="${toDir}"/>
|
|
</j:if>
|
|
|
|
</goal>
|
|
|
|
<!--==================================================================-->
|
|
<!-- Add MAVEN_REPO to classpath variables -->
|
|
<!--==================================================================-->
|
|
<goal name="eclipse:add-maven-repo"
|
|
description="Ensure that the classpath variable MAVEN_REPO is available">
|
|
|
|
<j:set var="ws" value="${maven.eclipse.workspace}X" />
|
|
<j:choose>
|
|
<j:when test='${ws != "X"}'>
|
|
<j:set var="variableFile" value="${maven.eclipse.workspace}/.metadata/.plugins/org.eclipse.jdt.core/pref_store.ini" />
|
|
<propertyfile file="${variableFile}">
|
|
<entry key="org.eclipse.jdt.core.classpathVariable.MAVEN_REPO"
|
|
default="${maven.repo.local}" />
|
|
</propertyfile>
|
|
</j:when>
|
|
<j:otherwise>The property $${maven.eclipse.workspace} was not set. MAVEN_REPO may not be set.</j:otherwise>
|
|
</j:choose>
|
|
</goal>
|
|
|
|
</project>
|