From bd2471432862c56d36c2cb82e180cbd4ba13943c Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 16 Feb 2016 22:21:11 +0100 Subject: [PATCH 01/20] updating poms for 3.0.1-SNAPSHOT development --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 07a5edc7..98ea747d 100644 --- a/pom.xml +++ b/pom.xml @@ -26,12 +26,12 @@ under the License. maven-plugins org.apache.maven.plugins 28 - + io.wcm.devops.maven.plugins eclipse-maven-plugin - 3.0.0-SNAPSHOT + 3.0.1-SNAPSHOT maven-plugin wcm.io DevOps Maven Eclipse Plugin From 723614a2c1acd8fa671e881e3c90c533009a2b37 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 16 Feb 2016 22:25:50 +0100 Subject: [PATCH 02/20] updating develop poms to master versions to avoid merge conflicts --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 98ea747d..2847121b 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ under the License. io.wcm.devops.maven.plugins eclipse-maven-plugin - 3.0.1-SNAPSHOT + 3.0.0 maven-plugin wcm.io DevOps Maven Eclipse Plugin From 67e75f1caf86606aebb0f096e97ea7bdae2cf7b7 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 16 Feb 2016 22:25:54 +0100 Subject: [PATCH 03/20] Updating develop poms back to pre merge state --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2847121b..98ea747d 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ under the License. io.wcm.devops.maven.plugins eclipse-maven-plugin - 3.0.0 + 3.0.1-SNAPSHOT maven-plugin wcm.io DevOps Maven Eclipse Plugin From ef9f66b1e4071d24c92cf7a1a0a3f4c0a1594e4c Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 16 Feb 2016 22:28:05 +0100 Subject: [PATCH 04/20] newlines --- .../WorkspaceDependencyResolveMojo.java | 402 ++++++------- .../plugin/eclipse/LinkedResourceTest.java | 120 ++-- .../eclipse/WorkspaceConfigurationTest.java | 114 ++-- .../plugin/eclipse/it/SelectorUtils.java | 568 +++++++++--------- .../multymodule-1/expected/.project | 48 +- .../multymodule-2/expected/.project | 50 +- .../multymodule-3/expected/.project | 38 +- .../multymodule-4/expected/.project | 44 +- 8 files changed, 692 insertions(+), 692 deletions(-) diff --git a/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceDependencyResolveMojo.java b/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceDependencyResolveMojo.java index d22d410e..7ed39ac2 100644 --- a/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceDependencyResolveMojo.java +++ b/src/main/java/org/apache/maven/plugin/eclipse/WorkspaceDependencyResolveMojo.java @@ -1,201 +1,201 @@ -package org.apache.maven.plugin.eclipse; - -/* - * 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.File; -import java.io.FileReader; -import java.util.ArrayList; -import java.util.List; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.artifact.factory.ArtifactFactory; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.ArtifactNotFoundException; -import org.apache.maven.artifact.resolver.ArtifactResolutionException; -import org.apache.maven.artifact.resolver.ArtifactResolver; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; -import org.codehaus.plexus.util.StringUtils; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomBuilder; - -/** - * For all projects currently part of the workspace, all references to the M2_REPO classpath variable are - * resolved. - *

- * Note: not the projects of the reactor are inspected for unresolved artifacts, but the projects that are part - * of the workspace. - * - * @since 2.10 - * @author agudian - */ -@Mojo( name = "resolve-workspace-dependencies", aggregator = true, requiresProject = false ) -public class WorkspaceDependencyResolveMojo - extends AbstractMojo -{ - /** - * The eclipse workspace directory. - *

- * If omitted, the parent directories of the working directory are checked. The first directory to contain a - * .metadata subdirectory is chosen. - */ - @Parameter( property = "eclipse.workspace" ) - private File workspace; - - @Component( role = ArtifactFactory.class ) - private ArtifactFactory artifactFactory; - - @Component( role = ArtifactResolver.class ) - private ArtifactResolver artifactResolver; - - @Parameter( property = "project.remoteArtifactRepositories", required = true, readonly = true ) - private List remoteArtifactRepositories; - - @Parameter( property = "localRepository", required = true, readonly = true ) - private ArtifactRepository localRepository; - - private List findProjectLocations( File workspaceLocation ) - { - return new ReadWorkspaceLocations().readProjectLocations( workspaceLocation, getLog() ); - } - - private void validateWorkspaceLocation() - throws MojoExecutionException - { - if ( workspace != null && !isWorkspaceDirectory( workspace ) ) - { - throw new MojoExecutionException( "Not a workspace directory: there is no subdirectory .metadata at " - + workspace ); - } - - if ( workspace == null ) - { - File currentWorkingDirectory = new File( "." ).getAbsoluteFile(); - while ( currentWorkingDirectory != null ) - { - if ( isWorkspaceDirectory( currentWorkingDirectory ) ) - { - getLog().debug( "Detected workspace at " + currentWorkingDirectory ); - workspace = currentWorkingDirectory; - return; - } - currentWorkingDirectory = currentWorkingDirectory.getParentFile(); - } - } - - throw new MojoExecutionException( "No workspace location configured " - + "and none can be detected in the parent directories." ); - } - - private boolean isWorkspaceDirectory( File currentWorkingDirectory ) - { - return new File( currentWorkingDirectory, ".metadata" ).isDirectory(); - } - - public void execute() - throws MojoExecutionException, MojoFailureException - { - validateWorkspaceLocation(); - - for ( File location : findProjectLocations( workspace ) ) - { - File classpathFile = new File( location, ".classpath" ); - if ( classpathFile.exists() ) - { - getLog().info( "Resolving M2_REPO dependencies in " + classpathFile ); - try - { - Xpp3Dom classpath = Xpp3DomBuilder.build( new FileReader( classpathFile ) ); - - for ( Xpp3Dom entry : classpath.getChildren() ) - { - if ( "var".equals( entry.getAttribute( "kind" ) ) ) - { - resolveIfNecessary( entry.getAttribute( "path" ) ); - resolveIfNecessary( entry.getAttribute( "sourcepath" ) ); - } - } - - } - catch ( Exception e ) - { - getLog().error( "Error parsing " + classpathFile, e ); - } - - } - } - } - - private void resolveIfNecessary( String path ) - throws ArtifactResolutionException - { - if ( null != path && path.startsWith( "M2_REPO" ) ) - { - try - { - Artifact artifact = createArtifactFromPath( path ); - if ( artifact != null ) - { - artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); - } - } - catch ( ArtifactNotFoundException e ) - { - getLog().info( e ); - } - } - } - - private Artifact createArtifactFromPath( String path ) - { - String[] elements = path.split( "/" ); - if ( elements.length < 4 ) - { - getLog().error( "Unexpected repository path structure: " + path ); - return null; - } - - List groupParts = new ArrayList(); - for ( int i = 1; i < elements.length - 3; i++ ) - { - groupParts.add( elements[i] ); - } - String group = StringUtils.join( groupParts.iterator(), "." ); - String artifactId = elements[elements.length - 3]; - String version = elements[elements.length - 2]; - - String classifier = null; - String fileName = elements[elements.length - 1]; - String type = fileName.substring( fileName.lastIndexOf( '.' ) + 1 ); - String possibleClassifier = - fileName.substring( artifactId.length() + version.length() + 1, fileName.length() - type.length() - 1 ); - if ( possibleClassifier.length() > 1 ) - { - classifier = possibleClassifier.substring( 1 ); - } - - return artifactFactory.createArtifactWithClassifier( group, artifactId, version, type, classifier ); - } -} +package org.apache.maven.plugin.eclipse; + +/* + * 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.File; +import java.io.FileReader; +import java.util.ArrayList; +import java.util.List; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.factory.ArtifactFactory; +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.resolver.ArtifactNotFoundException; +import org.apache.maven.artifact.resolver.ArtifactResolutionException; +import org.apache.maven.artifact.resolver.ArtifactResolver; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.codehaus.plexus.util.xml.Xpp3DomBuilder; + +/** + * For all projects currently part of the workspace, all references to the M2_REPO classpath variable are + * resolved. + *

+ * Note: not the projects of the reactor are inspected for unresolved artifacts, but the projects that are part + * of the workspace. + * + * @since 2.10 + * @author agudian + */ +@Mojo( name = "resolve-workspace-dependencies", aggregator = true, requiresProject = false ) +public class WorkspaceDependencyResolveMojo + extends AbstractMojo +{ + /** + * The eclipse workspace directory. + *

+ * If omitted, the parent directories of the working directory are checked. The first directory to contain a + * .metadata subdirectory is chosen. + */ + @Parameter( property = "eclipse.workspace" ) + private File workspace; + + @Component( role = ArtifactFactory.class ) + private ArtifactFactory artifactFactory; + + @Component( role = ArtifactResolver.class ) + private ArtifactResolver artifactResolver; + + @Parameter( property = "project.remoteArtifactRepositories", required = true, readonly = true ) + private List remoteArtifactRepositories; + + @Parameter( property = "localRepository", required = true, readonly = true ) + private ArtifactRepository localRepository; + + private List findProjectLocations( File workspaceLocation ) + { + return new ReadWorkspaceLocations().readProjectLocations( workspaceLocation, getLog() ); + } + + private void validateWorkspaceLocation() + throws MojoExecutionException + { + if ( workspace != null && !isWorkspaceDirectory( workspace ) ) + { + throw new MojoExecutionException( "Not a workspace directory: there is no subdirectory .metadata at " + + workspace ); + } + + if ( workspace == null ) + { + File currentWorkingDirectory = new File( "." ).getAbsoluteFile(); + while ( currentWorkingDirectory != null ) + { + if ( isWorkspaceDirectory( currentWorkingDirectory ) ) + { + getLog().debug( "Detected workspace at " + currentWorkingDirectory ); + workspace = currentWorkingDirectory; + return; + } + currentWorkingDirectory = currentWorkingDirectory.getParentFile(); + } + } + + throw new MojoExecutionException( "No workspace location configured " + + "and none can be detected in the parent directories." ); + } + + private boolean isWorkspaceDirectory( File currentWorkingDirectory ) + { + return new File( currentWorkingDirectory, ".metadata" ).isDirectory(); + } + + public void execute() + throws MojoExecutionException, MojoFailureException + { + validateWorkspaceLocation(); + + for ( File location : findProjectLocations( workspace ) ) + { + File classpathFile = new File( location, ".classpath" ); + if ( classpathFile.exists() ) + { + getLog().info( "Resolving M2_REPO dependencies in " + classpathFile ); + try + { + Xpp3Dom classpath = Xpp3DomBuilder.build( new FileReader( classpathFile ) ); + + for ( Xpp3Dom entry : classpath.getChildren() ) + { + if ( "var".equals( entry.getAttribute( "kind" ) ) ) + { + resolveIfNecessary( entry.getAttribute( "path" ) ); + resolveIfNecessary( entry.getAttribute( "sourcepath" ) ); + } + } + + } + catch ( Exception e ) + { + getLog().error( "Error parsing " + classpathFile, e ); + } + + } + } + } + + private void resolveIfNecessary( String path ) + throws ArtifactResolutionException + { + if ( null != path && path.startsWith( "M2_REPO" ) ) + { + try + { + Artifact artifact = createArtifactFromPath( path ); + if ( artifact != null ) + { + artifactResolver.resolve( artifact, remoteArtifactRepositories, localRepository ); + } + } + catch ( ArtifactNotFoundException e ) + { + getLog().info( e ); + } + } + } + + private Artifact createArtifactFromPath( String path ) + { + String[] elements = path.split( "/" ); + if ( elements.length < 4 ) + { + getLog().error( "Unexpected repository path structure: " + path ); + return null; + } + + List groupParts = new ArrayList(); + for ( int i = 1; i < elements.length - 3; i++ ) + { + groupParts.add( elements[i] ); + } + String group = StringUtils.join( groupParts.iterator(), "." ); + String artifactId = elements[elements.length - 3]; + String version = elements[elements.length - 2]; + + String classifier = null; + String fileName = elements[elements.length - 1]; + String type = fileName.substring( fileName.lastIndexOf( '.' ) + 1 ); + String possibleClassifier = + fileName.substring( artifactId.length() + version.length() + 1, fileName.length() - type.length() - 1 ); + if ( possibleClassifier.length() > 1 ) + { + classifier = possibleClassifier.substring( 1 ); + } + + return artifactFactory.createArtifactWithClassifier( group, artifactId, version, type, classifier ); + } +} diff --git a/src/test/java/org/apache/maven/plugin/eclipse/LinkedResourceTest.java b/src/test/java/org/apache/maven/plugin/eclipse/LinkedResourceTest.java index 9c659982..86c22880 100644 --- a/src/test/java/org/apache/maven/plugin/eclipse/LinkedResourceTest.java +++ b/src/test/java/org/apache/maven/plugin/eclipse/LinkedResourceTest.java @@ -1,60 +1,60 @@ -/* - * 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. - */ - -package org.apache.maven.plugin.eclipse; - -import static org.junit.Assert.assertEquals; - -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.junit.Test; - -public class LinkedResourceTest -{ - @Test - public void nodeWithOnlyLocationIsAccepted() - { - Xpp3Dom node = new Xpp3Dom("test"); - node.addChild(new Xpp3Dom("name")); - node.addChild(new Xpp3Dom("type")); - - Xpp3Dom location = new Xpp3Dom("location"); - location.setValue("the-location"); - - node.addChild(location); - - LinkedResource lr = new LinkedResource(node); - assertEquals("the-location", lr.getLocation()); - } - - @Test - public void nodeWithOnlyLocationUriIsAccepted() - { - Xpp3Dom node = new Xpp3Dom("test"); - node.addChild(new Xpp3Dom("name")); - node.addChild(new Xpp3Dom("type")); - - Xpp3Dom location = new Xpp3Dom("locationURI"); - location.setValue("the-location-uri"); - - node.addChild(location); - - LinkedResource lr = new LinkedResource(node); - assertEquals("the-location-uri", lr.getLocationURI()); - } -} +/* + * 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. + */ + +package org.apache.maven.plugin.eclipse; + +import static org.junit.Assert.assertEquals; + +import org.codehaus.plexus.util.xml.Xpp3Dom; +import org.junit.Test; + +public class LinkedResourceTest +{ + @Test + public void nodeWithOnlyLocationIsAccepted() + { + Xpp3Dom node = new Xpp3Dom("test"); + node.addChild(new Xpp3Dom("name")); + node.addChild(new Xpp3Dom("type")); + + Xpp3Dom location = new Xpp3Dom("location"); + location.setValue("the-location"); + + node.addChild(location); + + LinkedResource lr = new LinkedResource(node); + assertEquals("the-location", lr.getLocation()); + } + + @Test + public void nodeWithOnlyLocationUriIsAccepted() + { + Xpp3Dom node = new Xpp3Dom("test"); + node.addChild(new Xpp3Dom("name")); + node.addChild(new Xpp3Dom("type")); + + Xpp3Dom location = new Xpp3Dom("locationURI"); + location.setValue("the-location-uri"); + + node.addChild(location); + + LinkedResource lr = new LinkedResource(node); + assertEquals("the-location-uri", lr.getLocationURI()); + } +} diff --git a/src/test/java/org/apache/maven/plugin/eclipse/WorkspaceConfigurationTest.java b/src/test/java/org/apache/maven/plugin/eclipse/WorkspaceConfigurationTest.java index b27f2d7c..991c35c6 100644 --- a/src/test/java/org/apache/maven/plugin/eclipse/WorkspaceConfigurationTest.java +++ b/src/test/java/org/apache/maven/plugin/eclipse/WorkspaceConfigurationTest.java @@ -1,57 +1,57 @@ -package org.apache.maven.plugin.eclipse; - -/* - * 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 junit.framework.TestCase; - -public class WorkspaceConfigurationTest - extends TestCase -{ - - public void testGetWebsphereVersion() - { - WorkspaceConfiguration wc = new WorkspaceConfiguration(); - // Websphere Application Servers - final String was_express_v51 = "was.express.v51"; - wc.setDefaultDeployServerId( was_express_v51 ); - assertEquals( "5.1", wc.getWebsphereVersion() ); - - final String was_base_v51 = "was.base.v51"; - wc.setDefaultDeployServerId( was_base_v51 ); - assertEquals( "5.1", wc.getWebsphereVersion() ); - - final String was_base_v6 = "was.base.v6"; - wc.setDefaultDeployServerId( was_base_v6 ); - assertEquals( "6.0", wc.getWebsphereVersion() ); - - final String was_base_v61 = "was.base.v61"; - wc.setDefaultDeployServerId( was_base_v61 ); - assertEquals( "6.1", wc.getWebsphereVersion() ); - - final String was_base_v7 = "was.base.v7"; - wc.setDefaultDeployServerId( was_base_v7 ); - assertEquals( "7.0", wc.getWebsphereVersion() ); - - // Websphere Portals - //wps.base.v51 - //wps.base.v60 - //wps.base.v61 - } -} +package org.apache.maven.plugin.eclipse; + +/* + * 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 junit.framework.TestCase; + +public class WorkspaceConfigurationTest + extends TestCase +{ + + public void testGetWebsphereVersion() + { + WorkspaceConfiguration wc = new WorkspaceConfiguration(); + // Websphere Application Servers + final String was_express_v51 = "was.express.v51"; + wc.setDefaultDeployServerId( was_express_v51 ); + assertEquals( "5.1", wc.getWebsphereVersion() ); + + final String was_base_v51 = "was.base.v51"; + wc.setDefaultDeployServerId( was_base_v51 ); + assertEquals( "5.1", wc.getWebsphereVersion() ); + + final String was_base_v6 = "was.base.v6"; + wc.setDefaultDeployServerId( was_base_v6 ); + assertEquals( "6.0", wc.getWebsphereVersion() ); + + final String was_base_v61 = "was.base.v61"; + wc.setDefaultDeployServerId( was_base_v61 ); + assertEquals( "6.1", wc.getWebsphereVersion() ); + + final String was_base_v7 = "was.base.v7"; + wc.setDefaultDeployServerId( was_base_v7 ); + assertEquals( "7.0", wc.getWebsphereVersion() ); + + // Websphere Portals + //wps.base.v51 + //wps.base.v60 + //wps.base.v61 + } +} diff --git a/src/test/java/org/apache/maven/plugin/eclipse/it/SelectorUtils.java b/src/test/java/org/apache/maven/plugin/eclipse/it/SelectorUtils.java index 40a70d13..36d64ace 100644 --- a/src/test/java/org/apache/maven/plugin/eclipse/it/SelectorUtils.java +++ b/src/test/java/org/apache/maven/plugin/eclipse/it/SelectorUtils.java @@ -1,284 +1,284 @@ -package org.apache.maven.plugin.eclipse.it; - -/* - * 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.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Properties; - -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.Os; -import org.codehaus.plexus.util.StringUtils; - -/** - * Provides utility methods for selecting build jobs based on environmental conditions. - * - * From org.apache.maven.plugin.invoker.SelectorUtils - * - * @author Benjamin Bentmann - */ -class SelectorUtils -{ - - static void parseList( String list, Collection includes, Collection excludes ) - { - String[] tokens = ( list != null ) ? StringUtils.split( list, "," ) : new String[0]; - - for ( int i = 0; i < tokens.length; i++ ) - { - String token = tokens[i].trim(); - - if ( token.startsWith( "!" ) ) - { - excludes.add( token.substring( 1 ) ); - } - else - { - includes.add( token ); - } - } - } - - static boolean isOsFamily( String osSpec ) - { - List includes = new ArrayList(); - List excludes = new ArrayList(); - parseList( osSpec, includes, excludes ); - - return isOsFamily( includes, true ) && !isOsFamily( excludes, false ); - } - - static boolean isOsFamily( List families, boolean defaultMatch ) - { - if ( families != null && !families.isEmpty() ) - { - for ( String family : families ) - { - if ( Os.isFamily( family ) ) - { - return true; - } - } - - return false; - } - else - { - return defaultMatch; - } - } - - /** - * Retrieves the current Maven version. - * @return The current Maven version. - */ - static String getMavenVersion() - { - try - { - // This relies on the fact that MavenProject is the in core classloader - // and that the core classloader is for the maven-core artifact - // and that should have a pom.properties file - // if this ever changes, we will have to revisit this code. - Properties properties = new Properties(); - properties.load( MavenProject.class.getClassLoader().getResourceAsStream( - "META-INF/maven/org.apache.maven/maven-core/pom.properties" ) ); - return StringUtils.trim( properties.getProperty( "version" ) ); - } - catch ( Exception e ) - { - return null; - } - } - - static String getMavenVersion( File mavenHome ) - { - File mavenLib = new File( mavenHome, "lib" ); - File[] jarFiles = mavenLib.listFiles( new FilenameFilter() - { - public boolean accept( File dir, String name ) - { - return name.endsWith( ".jar" ); - } - } ); - - for ( File file : jarFiles ) - { - try - { - @SuppressWarnings( "deprecation" ) - URL url = - new URL( "jar:" + file.toURL().toExternalForm() - + "!/META-INF/maven/org.apache.maven/maven-core/pom.properties" ); - - Properties properties = new Properties(); - properties.load( url.openStream() ); - String version = StringUtils.trim( properties.getProperty( "version" ) ); - if ( version != null ) - { - return version; - } - } - catch ( MalformedURLException e ) - { - // ignore - } - catch ( IOException e ) - { - // ignore - } - } - return null; - } - - static boolean isMavenVersion( String mavenSpec ) - { - return isMavenVersion( mavenSpec, getMavenVersion() ); - } - - static boolean isMavenVersion( String mavenSpec, String actualVersion ) - { - List includes = new ArrayList(); - List excludes = new ArrayList(); - parseList( mavenSpec, includes, excludes ); - - List mavenVersionList = parseVersion( actualVersion ); - - return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false ); - } - - static String getJreVersion() - { - return System.getProperty( "java.version", "" ); - } - - static String getJreVersion( File javaHome ) - { - //@todo detect actual version - return null; - } - - static boolean isJreVersion( String jreSpec ) - { - return isJreVersion( jreSpec, getJreVersion() ); - } - - static boolean isJreVersion( String jreSpec, String actualJreVersion ) - { - List includes = new ArrayList(); - List excludes = new ArrayList(); - parseList( jreSpec, includes, excludes ); - - List jreVersion = parseVersion( actualJreVersion ); - - return isJreVersion( jreVersion, includes, true ) && !isJreVersion( jreVersion, excludes, false ); - } - - - static boolean isJreVersion( List jreVersion, List versionPatterns, boolean defaultMatch ) - { - if ( versionPatterns != null && !versionPatterns.isEmpty() ) - { - for ( String versionPattern : versionPatterns ) - { - if ( isJreVersion( jreVersion, versionPattern ) ) - { - return true; - } - } - - return false; - } - else - { - return defaultMatch; - } - } - - static boolean isJreVersion( List jreVersion, String versionPattern ) - { - List checkVersion = parseVersion( versionPattern ); - - if ( versionPattern.endsWith( "+" ) ) - { - // 1.5+ <=> [1.5,) - return compareVersions( jreVersion, checkVersion ) >= 0; - } - else if ( versionPattern.endsWith( "-" ) ) - { - // 1.5- <=> (,1.5) - return compareVersions( jreVersion, checkVersion ) < 0; - } - else - { - // 1.5 <=> [1.5,1.6) - return checkVersion.size() <= jreVersion.size() && checkVersion.equals( - jreVersion.subList( 0, checkVersion.size() ) ); - } - } - - static List parseVersion( String version ) - { - version = version.replaceAll( "[^0-9]", "." ); - - String[] tokens = StringUtils.split( version, "." ); - - List numbers = new ArrayList(); - - for ( int i = 0; i < tokens.length; i++ ) - { - numbers.add( Integer.valueOf( tokens[i] ) ); - } - - return numbers; - } - - static int compareVersions( List version1, List version2 ) - { - for ( Iterator it1 = version1.iterator(), it2 = version2.iterator(); ; ) - { - if ( !it1.hasNext() ) - { - return it2.hasNext() ? -1 : 0; - } - if ( !it2.hasNext() ) - { - return it1.hasNext() ? 1 : 0; - } - - Integer num1 = it1.next(); - Integer num2 = it2.next(); - - int rel = num1.compareTo( num2 ); - if ( rel != 0 ) - { - return rel; - } - } - } - -} +package org.apache.maven.plugin.eclipse.it; + +/* + * 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.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.Properties; + +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.Os; +import org.codehaus.plexus.util.StringUtils; + +/** + * Provides utility methods for selecting build jobs based on environmental conditions. + * + * From org.apache.maven.plugin.invoker.SelectorUtils + * + * @author Benjamin Bentmann + */ +class SelectorUtils +{ + + static void parseList( String list, Collection includes, Collection excludes ) + { + String[] tokens = ( list != null ) ? StringUtils.split( list, "," ) : new String[0]; + + for ( int i = 0; i < tokens.length; i++ ) + { + String token = tokens[i].trim(); + + if ( token.startsWith( "!" ) ) + { + excludes.add( token.substring( 1 ) ); + } + else + { + includes.add( token ); + } + } + } + + static boolean isOsFamily( String osSpec ) + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + parseList( osSpec, includes, excludes ); + + return isOsFamily( includes, true ) && !isOsFamily( excludes, false ); + } + + static boolean isOsFamily( List families, boolean defaultMatch ) + { + if ( families != null && !families.isEmpty() ) + { + for ( String family : families ) + { + if ( Os.isFamily( family ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + /** + * Retrieves the current Maven version. + * @return The current Maven version. + */ + static String getMavenVersion() + { + try + { + // This relies on the fact that MavenProject is the in core classloader + // and that the core classloader is for the maven-core artifact + // and that should have a pom.properties file + // if this ever changes, we will have to revisit this code. + Properties properties = new Properties(); + properties.load( MavenProject.class.getClassLoader().getResourceAsStream( + "META-INF/maven/org.apache.maven/maven-core/pom.properties" ) ); + return StringUtils.trim( properties.getProperty( "version" ) ); + } + catch ( Exception e ) + { + return null; + } + } + + static String getMavenVersion( File mavenHome ) + { + File mavenLib = new File( mavenHome, "lib" ); + File[] jarFiles = mavenLib.listFiles( new FilenameFilter() + { + public boolean accept( File dir, String name ) + { + return name.endsWith( ".jar" ); + } + } ); + + for ( File file : jarFiles ) + { + try + { + @SuppressWarnings( "deprecation" ) + URL url = + new URL( "jar:" + file.toURL().toExternalForm() + + "!/META-INF/maven/org.apache.maven/maven-core/pom.properties" ); + + Properties properties = new Properties(); + properties.load( url.openStream() ); + String version = StringUtils.trim( properties.getProperty( "version" ) ); + if ( version != null ) + { + return version; + } + } + catch ( MalformedURLException e ) + { + // ignore + } + catch ( IOException e ) + { + // ignore + } + } + return null; + } + + static boolean isMavenVersion( String mavenSpec ) + { + return isMavenVersion( mavenSpec, getMavenVersion() ); + } + + static boolean isMavenVersion( String mavenSpec, String actualVersion ) + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + parseList( mavenSpec, includes, excludes ); + + List mavenVersionList = parseVersion( actualVersion ); + + return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false ); + } + + static String getJreVersion() + { + return System.getProperty( "java.version", "" ); + } + + static String getJreVersion( File javaHome ) + { + //@todo detect actual version + return null; + } + + static boolean isJreVersion( String jreSpec ) + { + return isJreVersion( jreSpec, getJreVersion() ); + } + + static boolean isJreVersion( String jreSpec, String actualJreVersion ) + { + List includes = new ArrayList(); + List excludes = new ArrayList(); + parseList( jreSpec, includes, excludes ); + + List jreVersion = parseVersion( actualJreVersion ); + + return isJreVersion( jreVersion, includes, true ) && !isJreVersion( jreVersion, excludes, false ); + } + + + static boolean isJreVersion( List jreVersion, List versionPatterns, boolean defaultMatch ) + { + if ( versionPatterns != null && !versionPatterns.isEmpty() ) + { + for ( String versionPattern : versionPatterns ) + { + if ( isJreVersion( jreVersion, versionPattern ) ) + { + return true; + } + } + + return false; + } + else + { + return defaultMatch; + } + } + + static boolean isJreVersion( List jreVersion, String versionPattern ) + { + List checkVersion = parseVersion( versionPattern ); + + if ( versionPattern.endsWith( "+" ) ) + { + // 1.5+ <=> [1.5,) + return compareVersions( jreVersion, checkVersion ) >= 0; + } + else if ( versionPattern.endsWith( "-" ) ) + { + // 1.5- <=> (,1.5) + return compareVersions( jreVersion, checkVersion ) < 0; + } + else + { + // 1.5 <=> [1.5,1.6) + return checkVersion.size() <= jreVersion.size() && checkVersion.equals( + jreVersion.subList( 0, checkVersion.size() ) ); + } + } + + static List parseVersion( String version ) + { + version = version.replaceAll( "[^0-9]", "." ); + + String[] tokens = StringUtils.split( version, "." ); + + List numbers = new ArrayList(); + + for ( int i = 0; i < tokens.length; i++ ) + { + numbers.add( Integer.valueOf( tokens[i] ) ); + } + + return numbers; + } + + static int compareVersions( List version1, List version2 ) + { + for ( Iterator it1 = version1.iterator(), it2 = version2.iterator(); ; ) + { + if ( !it1.hasNext() ) + { + return it2.hasNext() ? -1 : 0; + } + if ( !it2.hasNext() ) + { + return it1.hasNext() ? 1 : 0; + } + + Integer num1 = it1.next(); + Integer num2 = it2.next(); + + int rel = num1.compareTo( num2 ); + if ( rel != 0 ) + { + return rel; + } + } + } + +} diff --git a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-1/expected/.project b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-1/expected/.project index 322e97b9..0331cd22 100644 --- a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-1/expected/.project +++ b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-1/expected/.project @@ -1,25 +1,25 @@ - - - prefix-multymodule-1-1.0 - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - multymodule-4-1.0 - - - - org.eclipse.jdt.core.javabuilder - - - org.eclipse.wst.common.project.facet.core.builder - - - org.eclipse.wst.validation.validationbuilder - - - - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - + + + prefix-multymodule-1-1.0 + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + multymodule-4-1.0 + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.wst.validation.validationbuilder + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + \ No newline at end of file diff --git a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-2/expected/.project b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-2/expected/.project index 74cd2080..d0093fb5 100644 --- a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-2/expected/.project +++ b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-2/expected/.project @@ -1,26 +1,26 @@ - - - multymodule-2-1.0 - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - prefix-multymodule-1-1.0 - multymodule-4-1.0 - - - - org.eclipse.jdt.core.javabuilder - - - org.eclipse.wst.common.project.facet.core.builder - - - org.eclipse.wst.validation.validationbuilder - - - - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - + + + multymodule-2-1.0 + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + prefix-multymodule-1-1.0 + multymodule-4-1.0 + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.wst.validation.validationbuilder + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + \ No newline at end of file diff --git a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-3/expected/.project b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-3/expected/.project index ed661e58..a36d193f 100644 --- a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-3/expected/.project +++ b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-3/expected/.project @@ -1,20 +1,20 @@ - - - multymodule-3-1.0 - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - multymodule-2-1.0 - - - - org.eclipse.wst.common.project.facet.core.builder - - - org.eclipse.wst.validation.validationbuilder - - - - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.wst.common.modulecore.ModuleCoreNature - + + + multymodule-3-1.0 + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + multymodule-2-1.0 + + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.wst.validation.validationbuilder + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.wst.common.modulecore.ModuleCoreNature + \ No newline at end of file diff --git a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-4/expected/.project b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-4/expected/.project index ed613432..be5dedcd 100644 --- a/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-4/expected/.project +++ b/src/test/resources/projects/project-51-MECLIPSE-415/multymodule-4/expected/.project @@ -1,23 +1,23 @@ - - - multymodule-4-1.0 - NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. - - - - org.eclipse.jdt.core.javabuilder - - - org.eclipse.wst.common.project.facet.core.builder - - - org.eclipse.wst.validation.validationbuilder - - - - org.eclipse.wst.common.project.facet.core.nature - org.eclipse.jdt.core.javanature - org.eclipse.wst.common.modulecore.ModuleCoreNature - org.eclipse.jem.workbench.JavaEMFNature - + + + multymodule-4-1.0 + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.wst.validation.validationbuilder + + + + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature + org.eclipse.wst.common.modulecore.ModuleCoreNature + org.eclipse.jem.workbench.JavaEMFNature + \ No newline at end of file From ec27176b2c2ac8a53a65d1338940b87ee5cc33d5 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 16 Feb 2016 22:32:30 +0100 Subject: [PATCH 05/20] add version --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index bf0530d9..4c5c7747 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ To use this in your projects update all your POMs to use io.wcm.devops.maven.plugins eclipse-maven-plugin + 3.0.0 ``` From 3641a78f016425c0478d518cc3d6f4c14705a893 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 31 Jan 2017 15:03:11 +0100 Subject: [PATCH 06/20] rename to Eclipse Maven Plugin --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4c5c7747..301ed03d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - Maven Eclipse Plugin + Eclipse Maven Plugin ====== [![Build Status](https://travis-ci.org/wcm-io-devops/maven-eclipse-plugin.png?branch=develop)](https://travis-ci.org/wcm-io-devops/maven-eclipse-plugin) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven.plugins/eclipse-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven.plugins/eclipse-maven-plugin) @@ -7,7 +7,7 @@ The Eclipse Plugin is used to generate Eclipse IDE files (.project, .classpath a This is a fork of the original [Maven Eclipse Plugin](https://maven.apache.org/plugins/maven-eclipse-plugin/) which [was retired end of 2015](http://mail-archives.apache.org/mod_mbox/maven-dev/201510.mbox/%3Cop.x55dxii1kdkhrr%40robertscholte.dynamic.ziggo.nl%3E) in favor of the m2e Eclipse integration. -In our wcm.io and other Maven-based projects we usually use both m2e Integration and the Maven Eclipse Plugin. The Maven Eclipse Plugin is used to generate project-specific eclipse settings files and further files for Checkstyle, Findbugs and PMD based on a global build tools artifact defined a parent POM like `io.wcm.maven:io.wcm.maven.global-parent`, see [Global Parent](http://wcm.io/tooling/maven/global-parent.html) documentation for details. +In our wcm.io and other Maven-based projects we usually use both m2e Integration and the Eclipse Maven Plugin. The Eclipse Maven Plugin is used to generate project-specific eclipse settings files and further files for Checkstyle, Findbugs and PMD based on a global build tools artifact defined a parent POM like `io.wcm.maven:io.wcm.maven.global-parent`, see [Global Parent](http://wcm.io/tooling/maven/global-parent.html) documentation for details. So we maintain a fork of the original plugin here and publish it under Apache 2.0 license within the wcm.io DevOps project. From 9743724a4b2d79213225722248ee7842237f44ec Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 31 Jan 2017 15:03:59 +0100 Subject: [PATCH 07/20] rename to Eclipse Maven Plugin --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 98ea747d..1df0ffe9 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ under the License. 3.0.1-SNAPSHOT maven-plugin - wcm.io DevOps Maven Eclipse Plugin + wcm.io DevOps Eclipse Maven Plugin The Eclipse Plugin is used to generate Eclipse IDE files (.project, .classpath and the .settings folder) from a POM. From 516e58cb473e257c965b7078ec37adf996ced2e7 Mon Sep 17 00:00:00 2001 From: sseifert Date: Thu, 23 Feb 2017 13:21:08 +0100 Subject: [PATCH 08/20] update .gitignore --- .gitignore | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index aa5f9f86..956ee987 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -# This is the central .gitignore file for all pro!vision GIT repos. Please do not change it on project-level. -# See https://jira.pvtool.org/confluence/x/IACuBg for details. - target/ pom.xml.tag pom.xml.releaseBackup @@ -8,6 +5,7 @@ pom.xml.versionsBackup pom.xml.next release.properties maven-eclipse.xml +infinitest.filters node_modules/ npm-debug.log @@ -20,6 +18,7 @@ npm-debug.log .pmd .checkstyle .idea +.vagrant *.iml .DS_Store .rubygems From 295c3a3efd7ed9ded01c1d4d6b27b2ee07527a54 Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 27 Mar 2017 09:29:46 +0200 Subject: [PATCH 09/20] update badge paths --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 301ed03d..a9a6e06e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Eclipse Maven Plugin ====== -[![Build Status](https://travis-ci.org/wcm-io-devops/maven-eclipse-plugin.png?branch=develop)](https://travis-ci.org/wcm-io-devops/maven-eclipse-plugin) +[![Build Status](https://travis-ci.org/wcm-io-devops/eclipse-maven-plugin.png?branch=develop)](https://travis-ci.org/wcm-io-devops/eclipse-maven-plugin) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven.plugins/eclipse-maven-plugin/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.wcm.devops.maven.plugins/eclipse-maven-plugin) The Eclipse Plugin is used to generate Eclipse IDE files (.project, .classpath and the .settings folder) from a POM. From 8e2dc7b02e94607168e2e772775481ac34e76981 Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 11 Sep 2017 13:35:56 +0200 Subject: [PATCH 10/20] update nexus-staging-maven-plugin to latest version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1df0ffe9..86eb2b1f 100644 --- a/pom.xml +++ b/pom.xml @@ -356,7 +356,7 @@ under the License. org.sonatype.plugins nexus-staging-maven-plugin - 1.6.6 + 1.6.8 external.atlassian.jgitflow From 446c5c04d5e71147b61effed3a3388aab3c82b83 Mon Sep 17 00:00:00 2001 From: sseifert Date: Tue, 28 Nov 2017 14:25:12 +0100 Subject: [PATCH 11/20] use default 'release-profile' name --- pom.xml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 86eb2b1f..712c7518 100644 --- a/pom.xml +++ b/pom.xml @@ -341,8 +341,6 @@ under the License. 2.5.3 true - false - release deploy @@ -564,7 +562,7 @@ under the License. - release + release-profile performRelease From 40ba06924cc3e28b319384367dcb045f217b0a2b Mon Sep 17 00:00:00 2001 From: sseifert Date: Mon, 4 Dec 2017 13:25:05 +0100 Subject: [PATCH 12/20] fix regex for release tags (without xyz- prefix) --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a16da97..755299a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,10 +32,10 @@ script: # Remove wcm.io artefacts from repository before cache - rm -rf $HOME/.m2/repository/io/wcm -# exlude release tags like xyz-1.0.0 or xyz-1 +# exlude release tags like 1.0.0 branches: except: - - /^.*\-\d+(\.\d+\.\d+)?(\..*|\-.*)?$/ + - /^\d+(\.\d+\.\d+)?(\..*|\-.*)?$/ # Cache Maven Repository cache: From d9cfe8ca61172b3f530a89f97dcd6a40e6de67dd Mon Sep 17 00:00:00 2001 From: sseifert Date: Sun, 8 Jul 2018 20:09:29 +0200 Subject: [PATCH 13/20] add support for "filtering" property for eclipse configuration files --- .gitignore | 2 + pom.xml | 11 ++++ .../plugin/eclipse/EclipseConfigFile.java | 25 ++++++++ .../maven/plugin/eclipse/EclipsePlugin.java | 57 ++++++++++++++++++- 4 files changed, 94 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 956ee987..30d032fb 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,5 @@ npm-debug.log *.sublime-* *nbactions*.xml .temp/ + +pom-test.xml diff --git a/pom.xml b/pom.xml index 712c7518..dffdb6e6 100644 --- a/pom.xml +++ b/pom.xml @@ -139,6 +139,16 @@ under the License. wagon-provider-api 2.1 + + org.apache.maven.shared + maven-filtering + 3.1.1 + + + org.codehaus.plexus + plexus-interpolation + 1.25 + commons-io commons-io @@ -320,6 +330,7 @@ under the License. README-testing.txt README.md + infinitest.filters + + only-eclipse + + + m2e.version + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-plugin-plugin + [3.4,) + + descriptor + helpmojo + + + + + + + + + org.apache.rat + apache-rat-plugin + [0.11,) + + check + + + + + + + + + + + + + + From 63bf22228f73889d097724ab2bcbd977e32727af Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 11 Jul 2018 12:41:16 +0200 Subject: [PATCH 16/20] Mark test source folders as "test" for Eclipse 4.8 Photon (since 3.1.0) --- README.md | 1 + .../writers/EclipseClasspathWriter.java | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index f9fb14a9..f6a9bf6b 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Changes since the original Maven Eclipse Plugin 2.10: * Patch from [MECLIPSE-641](https://issues.apache.org/jira/browse/MECLIPSE-641) which was never applied to the original code base, but is important for generating the eclipse project settings (since 3.0.0) * Add support for `filtering` property on additionalConfig files (since 3.1.0) +* Mark test source folders as "test" for Eclipse 4.8 Photon (since 3.1.0) To use this in your projects update all your POMs to use diff --git a/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java b/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java index 75503da5..d5de36cf 100644 --- a/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java +++ b/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java @@ -254,6 +254,28 @@ public void write() writer.addAttribute( ATTR_EXCLUDING, excludes ); } + boolean attributeElemOpen = false; + + // mark test dependencies as "test" (required for eclipse 4.8 photon) + if ( dir.isTest() ) + { + if ( !attributeElemOpen ) + { + writer.startElement( ATTRIBUTES ); + attributeElemOpen = true; + } + + writer.startElement( ATTRIBUTE ); + writer.addAttribute( VALUE, "true" ); + writer.addAttribute( NAME, "test" ); + writer.endElement(); + } + + if ( attributeElemOpen ) + { + writer.endElement(); + } + writer.endElement(); } From 2fa633e213c0d36d9548e951a1cf4920cb74c28d Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 11 Jul 2018 12:45:40 +0200 Subject: [PATCH 17/20] update dependency --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa9fd0d4..78988f4c 100644 --- a/pom.xml +++ b/pom.xml @@ -358,7 +358,7 @@ under the License. org.apache.maven.scm maven-scm-provider-gitexe - 1.9.4 + 1.10.0 From 0a8fd8295d8eace0e5aa842d386b649133f9f065 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 11 Jul 2018 12:57:08 +0200 Subject: [PATCH 18/20] Mark test source folders and test dependencies as "test" for Eclipse 4.8 Photon (since 3.1.0) --- README.md | 2 +- .../eclipse/writers/EclipseClasspathWriter.java | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f6a9bf6b..7a0830cb 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Changes since the original Maven Eclipse Plugin 2.10: * Patch from [MECLIPSE-641](https://issues.apache.org/jira/browse/MECLIPSE-641) which was never applied to the original code base, but is important for generating the eclipse project settings (since 3.0.0) * Add support for `filtering` property on additionalConfig files (since 3.1.0) -* Mark test source folders as "test" for Eclipse 4.8 Photon (since 3.1.0) +* Mark test source folders and test dependencies as "test" for Eclipse 4.8 Photon (since 3.1.0) To use this in your projects update all your POMs to use diff --git a/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java b/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java index d5de36cf..dc17faf4 100644 --- a/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java +++ b/src/main/java/org/apache/maven/plugin/eclipse/writers/EclipseClasspathWriter.java @@ -256,7 +256,7 @@ public void write() boolean attributeElemOpen = false; - // mark test dependencies as "test" (required for eclipse 4.8 photon) + // mark test source folders as "test" (required for eclipse 4.8 photon) if ( dir.isTest() ) { if ( !attributeElemOpen ) @@ -553,6 +553,21 @@ protected void addDependency( XMLWriter writer, IdeDependency dep ) boolean attributeElemOpen = false; + // mark test dependencies as "test" (required for eclipse 4.8 photon) + if ( dep.isTestDependency() ) + { + if ( !attributeElemOpen ) + { + writer.startElement( ATTRIBUTES ); + attributeElemOpen = true; + } + + writer.startElement( ATTRIBUTE ); + writer.addAttribute( VALUE, "true" ); + writer.addAttribute( NAME, "test" ); + writer.endElement(); + } + if ( javadocpath != null ) { if ( !attributeElemOpen ) From 7001efa846625dc2737b90a230cc8448699adc89 Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 11 Jul 2018 20:35:18 +0200 Subject: [PATCH 19/20] updating poms for 3.1.0 branch with snapshot versions --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 78988f4c..6491adcd 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ under the License. io.wcm.devops.maven.plugins eclipse-maven-plugin - 3.0.1-SNAPSHOT + 3.1.0-SNAPSHOT maven-plugin wcm.io DevOps Eclipse Maven Plugin @@ -650,7 +650,7 @@ under the License. - + @@ -663,7 +663,7 @@ under the License. - + From 587f3ebc8c215422f4bcc9630d17efd7649d174f Mon Sep 17 00:00:00 2001 From: sseifert Date: Wed, 11 Jul 2018 20:35:24 +0200 Subject: [PATCH 20/20] updating poms for branch'release/3.1.0' with non-snapshot versions --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6491adcd..b4e945e1 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ under the License. io.wcm.devops.maven.plugins eclipse-maven-plugin - 3.1.0-SNAPSHOT + 3.1.0 maven-plugin wcm.io DevOps Eclipse Maven Plugin