Author: rfscholte Date: Wed Jul 27 21:12:19 2011 New Revision: 1151629 URL: http://svn.apache.org/viewvc?rev=1151629&view=rev Log: Fix MECLIPSE-692: .project contains projects which were skipped during reactor build Introducing maven-invoker-plugin
Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/invoker.properties maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/verify.bsh maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/it/settings.xml Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Modified: maven/plugins/trunk/maven-eclipse-plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/pom.xml?rev=1151629&r1=1151628&r2=1151629&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/pom.xml (original) +++ maven/plugins/trunk/maven-eclipse-plugin/pom.xml Wed Jul 27 21:12:19 2011 @@ -330,6 +330,26 @@ under the License. <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <version>1.5</version> + <executions> + <execution> + <id>integration-test</id> + <goals> + <goal>install</goal> + <goal>run</goal> + </goals> + </execution> + </executions> + <configuration> + <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + <postBuildHookScript>verify</postBuildHookScript> + <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> + <settingsFile>src/it/settings.xml</settingsFile> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.9</version> <executions> Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/invoker.properties?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/invoker.properties (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/invoker.properties Wed Jul 27 21:12:19 2011 @@ -0,0 +1 @@ +invoker.goals = clean eclipse:eclipse \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/pom.xml?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/jar-module/pom.xml Wed Jul 27 21:12:19 2011 @@ -0,0 +1,12 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>parent-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>jardep-meclipse-692</artifactId> + +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/pom.xml?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom-module/pom.xml Wed Jul 27 21:12:19 2011 @@ -0,0 +1,21 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>parent-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>pomdep-meclipse-692</artifactId> + <packaging>pom</packaging> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.8.2</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom.xml?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/pom.xml Wed Jul 27 21:12:19 2011 @@ -0,0 +1,30 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>parent-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-eclipse-plugin</artifactId> + <version>@project.version@</version> + <executions> + <execution> + <goals> + <goal>eclipse</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <modules> + <module>war-module</module> + <module>jar-module</module> + <module>pom-module</module> + </modules> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/verify.bsh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/verify.bsh?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/verify.bsh (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/verify.bsh Wed Jul 27 21:12:19 2011 @@ -0,0 +1,71 @@ + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + +import java.io.*; +import java.util.*; +import java.util.jar.*; +import org.codehaus.plexus.util.*; + +boolean result = true; + +try +{ + File jarModuleDotProject = new File( basedir, "jar-module/.project"); + if( !jarModuleDotProject.exists() ) + { + System.err.println( "Expected jar-module/.project, but file doesn't exist" ); + return false; + } + + File pomModuleDotProject = new File( basedir, "pom-module/.project"); + if( pomModuleDotProject.exists() ) + { + System.err.println( "Did not expected pom-module/.project, but file exists" ); + return false; + } + + File warModuleDotProject = new File( basedir, "war-module/.project"); + if( !warModuleDotProject.exists() ) + { + System.err.println( "Expected war-module/.project, but file doesn't exist" ); + return false; + } + + String dotProjectContent = FileUtils.fileRead( warModuleDotProject, "UTF-8" ); + if ( dotProjectContent.indexOf( "<project>jardep-meclipse-692</project>" ) < 0 ) + { + System.err.println( "Expected war-module/.project to contains '<project>jardep-meclipse-692</project>', but it didn't" ); + return false; + } + + String dotProjectContent = FileUtils.fileRead( warModuleDotProject, "UTF-8" ); + if ( dotProjectContent.indexOf( "<project>pomdep-meclipse-692</project>" ) >= 0 ) + { + System.err.println( "Expected war-module/.project to not contain '<project>pomdep-meclipse-692</project>', but it did" ); + return false; + } + +} +catch ( Exception e) +{ + e.printStackTrace(); + result = false; +} +return result; \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/pom.xml?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/pom.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/MECLIPSE-692/war-module/pom.xml Wed Jul 27 21:12:19 2011 @@ -0,0 +1,39 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>parent-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + </parent> + + <artifactId>war-meclipse-692</artifactId> + <packaging>war</packaging> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <version>2.1.1</version> + <configuration> + <failOnMissingWebXml>false</failOnMissingWebXml> + </configuration> + </plugin> + </plugins> + </build> + + <dependencies> + <dependency> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>pomdep-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + <type>pom</type> + </dependency> + <dependency> + <groupId>org.apache.maven.plugins.it</groupId> + <artifactId>jardep-meclipse-692</artifactId> + <version>0.0.1-SNAPSHOT</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: maven/plugins/trunk/maven-eclipse-plugin/src/it/settings.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/it/settings.xml?rev=1151629&view=auto ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/it/settings.xml (added) +++ maven/plugins/trunk/maven-eclipse-plugin/src/it/settings.xml Wed Jul 27 21:12:19 2011 @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + <profiles> + <profile> + <id>it-repo</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <repositories> + <repository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </repository> + </repositories> + <pluginRepositories> + <pluginRepository> + <id>local.central</id> + <url>@localRepositoryUrl@</url> + <releases> + <enabled>true</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + </pluginRepository> + </pluginRepositories> + </profile> + </profiles> +</settings> Modified: maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java?rev=1151629&r1=1151628&r2=1151629&view=diff ============================================================================== --- maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java (original) +++ maven/plugins/trunk/maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipsePlugin.java Wed Jul 27 21:12:19 2011 @@ -1981,6 +1981,19 @@ public class EclipsePlugin } /** + * Utility method that locates a project producing the given artifact + * and verifies if it's a valid Eclipse project. + * + * @param artifact the artifact a project should produce. + * @return <code>true</code> if the artifact is produced by a reactor projectart. + */ + protected boolean isAvailableAsAReactorProject( Artifact artifact ) + { + MavenProject project = getReactorProject( artifact ); + return ( project != null && new File( project.getBasedir(), ".project" ).exists() ) ; + } + + /** * Utility method that locates a project in the workspace for the given artifact. * * @param artifact the artifact a project should produce.