MPECLIPSE-56 Only create .classpath and javabuilder if sources are present

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116241 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
epugh committed 2004-11-16 10:48:16 +00:00
1 parent f91db5539d
commit 86b723c835
6 files changed
+122 -1

No files matched your search

+4 -1
View File
@@ -56,7 +56,10 @@
<!--==================================================================-->
<goal name="eclipse"
description="Generate Eclipse project files"
prereqs="eclipse:generate-project, eclipse:generate-classpath">
prereqs="eclipse:generate-project">
<j:if test="${sourcesPresent}">
<attainGoal name="eclipse:generate-classpath" />
</j:if>
<ant:echo>Now refresh your project in Eclipse (right click on the project and select "Refresh")</ant:echo>
</goal>
@@ -36,6 +36,7 @@
</j:if>
</j:forEach>
</projects>
<j:if test="${sourcesPresent}">
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
@@ -57,6 +58,7 @@
<nature>${nature}</nature>
</j:forEach>
</natures>
</j:if>
</projectDescription>
</j:whitespace>
@@ -0,0 +1,2 @@
.classpath
.project
@@ -0,0 +1,62 @@
<!--
/*
* 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-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"/>
<u:available file="${dotClasspath}">
<j:set var="classpathFound" value="true"/>
</u:available>
<j:if test="${classpathFound}">
<ant:fail>The classpath file was created, and shouldn't have been.</ant:fail>
</j:if>
</goal>
<goal name="test-project">
<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>
</project>
@@ -0,0 +1,48 @@
<?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</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</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
</build>
</project>
+4
View File
@@ -24,6 +24,10 @@
<author email="dion@multitask.com.au">dIon Gillard</author>
</properties>
<body>
<release version="1.10" date="IN CVS">
<action dev="epugh" type="fix" issue="MPECLIPSE-56" due-to="Archimedes Trajano">Only create .classpath and javabuilder if sources are present
</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.