maven-invoker-plugin-1.5/0000755000175000017500000000000011623526251014203 5ustar tonytonymaven-invoker-plugin-1.5/pom.xml0000644000175000017500000002161311270401746015522 0ustar tonytony 4.0.0 maven-plugins org.apache.maven.plugins 14 maven-invoker-plugin 1.5 maven-plugin Maven Invoker Plugin The Maven Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution is successful, and optionally can verify the output generated from a given project execution. 2.0.6 scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.5 scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.5 http://svn.apache.org/viewvc/maven/plugins/tags/maven-invoker-plugin-1.5 jira http://jira.codehaus.org/browse/MINVOKER 2.0.6 1.0-alpha-11 1.0-alpha-11 org.apache.maven.shared maven-invoker 2.0.11 org.apache.maven maven-project ${mavenVersion} org.apache.maven maven-model ${mavenVersion} org.apache.maven maven-plugin-api ${mavenVersion} org.apache.maven maven-artifact ${mavenVersion} org.apache.maven maven-settings ${mavenVersion} org.apache.maven.reporting maven-reporting-api ${mavenVersion} org.apache.maven.reporting maven-reporting-impl 2.0.4.1 org.apache.maven.doxia doxia-sink-api ${doxiaVersion} org.apache.maven.doxia doxia-site-renderer ${doxia-sitetoolsVersion} org.codehaus.plexus plexus-container-default org.codehaus.plexus plexus-component-api org.beanshell bsh 2.0b4 org.codehaus.groovy groovy 1.5.6 junit junit org.apache.ant ant 1.7.1 org.apache.ant ant-launcher org.codehaus.plexus plexus-utils 1.5.6 org.codehaus.plexus plexus-interpolation 1.2 org.codehaus.plexus plexus-i18n 1.0-beta-7 org.codehaus.plexus plexus-container-default org.codehaus.plexus plexus-component-api junit junit 3.8.2 test org.apache.maven.plugin-testing maven-plugin-testing-harness 1.2 test org.codehaus.modello modello-maven-plugin xpp3-reader xpp3-writer java src/main/mdo/invocation.mdo 1.0.0 run-its 2.0.1 maven-invoker-plugin 1.4 true src/it ${project.build.directory}/it */pom.xml setup verify ${project.build.directory}/local-repo src/it/settings.xml clean initialize ${project.version} integration-test install run maven-3 ${basedir} 3.0-beta-1-SNAPSHOT maven-invoker-plugin-1.5/src/0000755000175000017500000000000011623526250014771 5ustar tonytonymaven-invoker-plugin-1.5/src/test/0000755000175000017500000000000011623526250015750 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/0000755000175000017500000000000011623526250016671 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/0000755000175000017500000000000011623526250017460 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/apache/0000755000175000017500000000000011623526250020701 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/apache/maven/0000755000175000017500000000000011623526250022007 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/0000755000175000017500000000000011623526250023305 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/0000755000175000017500000000000011623526250024762 5ustar tonytonymaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/SelectorUtilsTest.java0000644000175000017500000000743511255230257031277 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.ArrayList; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; /** * Tests {@link SelectorUtils}. * * @author Benjamin Bentmann */ public class SelectorUtilsTest extends TestCase { private List list( int[] numbers ) { List result = new ArrayList(); for ( int i = 0; i < numbers.length; i++ ) { result.add( new Integer( numbers[i] ) ); } return result; } public void testParseList() { List includes = new ArrayList(); List excludes = new ArrayList(); SelectorUtils.parseList( null, includes, excludes ); SelectorUtils.parseList( " 1.5, !1.4, 1.6+ ", includes, excludes ); assertEquals( Arrays.asList( new String[] { "1.5", "1.6+" } ), includes ); assertEquals( Arrays.asList( new String[] { "1.4" } ), excludes ); } public void testParseVersion() { assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12" ) ); assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12+" ) ); assertEquals( list( new int[] { 1, 6, 0, 12 } ), SelectorUtils.parseVersion( "1.6.0_12-" ) ); } public void testCompareVersions() { assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 6 } ) ) == 0 ); assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 5 } ), list( new int[] { 1, 6 } ) ) < 0 ); assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1, 5 } ) ) > 0 ); assertTrue( SelectorUtils.compareVersions( list( new int[] { 1 } ), list( new int[] { 1, 6 } ) ) < 0 ); assertTrue( SelectorUtils.compareVersions( list( new int[] { 1, 6 } ), list( new int[] { 1 } ) ) > 0 ); } public void testIsMatchingJre() { assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5" ) ); assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5" ) ); assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5+" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5+" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5+" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5+" ) ); assertTrue( SelectorUtils.isJreVersion( list( new int[] { 1, 4, 2, 8 } ), "1.5-" ) ); assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5 } ), "1.5-" ) ); assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 5, 9 } ), "1.5-" ) ); assertFalse( SelectorUtils.isJreVersion( list( new int[] { 1, 6 } ), "1.5-" ) ); } } maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java0000644000175000017500000001121311242031713030715 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.Arrays; import java.util.Collections; import java.util.List; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.plugin.invoker.model.BuildJob; import org.apache.maven.settings.Settings; /** * @author olamy * @since 18 nov. 07 * @version $Id: InvokerMojoTest.java 804712 2009-08-16 16:28:59Z bentmann $ */ public class InvokerMojoTest extends AbstractMojoTestCase { /** * test reading goals from a file */ public void testReadGoalsFromFile() throws Exception { MavenProjectStub project = new MavenProjectStub(); project.setTestClasspathElements( Collections.EMPTY_LIST ); InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" ); setVariableValueToObject( invokerMojo, "project", project ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); String dirPath = getBasedir() + "/src/test/resources/unit/goals-from-file/"; List goals = invokerMojo.getGoals( new File( dirPath ) ); assertEquals( 3, goals.size() ); } public void testSingleInvokerTest() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" ); String dirPath = getBasedir() + "/src/test/resources/unit"; List goals = invokerMojo.getGoals( new File( dirPath ) ); assertEquals( 1, goals.size() ); setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*" ); BuildJob[] poms = invokerMojo.getBuildJobs(); System.out.println( Arrays.asList( poms ) ); assertEquals( 1, poms.length ); } public void testMultiInvokerTest() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" ); String dirPath = getBasedir() + "/src/test/resources/unit"; List goals = invokerMojo.getGoals( new File( dirPath ) ); assertEquals( 1, goals.size() ); setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*,*terpolatio*" ); BuildJob[] poms = invokerMojo.getBuildJobs(); System.out.println( Arrays.asList( poms ) ); assertEquals( 2, poms.length ); } public void testFullPatternInvokerTest() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" ); String dirPath = getBasedir() + "/src/test/resources/unit"; List goals = invokerMojo.getGoals( new File( dirPath ) ); assertEquals( 1, goals.size() ); setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) ); setVariableValueToObject( invokerMojo, "invokerTest", "*" ); BuildJob[] poms = invokerMojo.getBuildJobs(); System.out.println( Arrays.asList( poms ) ); assertEquals( 4, poms.length ); } public void testAlreadyCloned() throws Exception { assertFalse( AbstractInvokerMojo.alreadyCloned( "dir", Collections.EMPTY_LIST ) ); assertTrue( AbstractInvokerMojo.alreadyCloned( "dir", Collections.singletonList( "dir" ) ) ); assertTrue( AbstractInvokerMojo.alreadyCloned( "dir" + File.separator + "sub", Collections.singletonList( "dir" ) ) ); assertFalse( AbstractInvokerMojo.alreadyCloned( "dirs", Collections.singletonList( "dir" ) ) ); } } ././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.javamaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java0000644000175000017500000000306311011272362032534 0ustar tonytony/* * 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.invoker; import org.apache.maven.model.Scm; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import java.util.Properties; /** * @author olamy * @since 22 nov. 07 * @version $Id: ExtendedMavenProjectStub.java 655038 2008-05-10 10:12:02Z bentmann $ */ public class ExtendedMavenProjectStub extends MavenProjectStub { private Scm scm; private Properties properties; public Scm getScm() { return scm; } public void setScm( Scm scm ) { this.scm = scm; } public Properties getProperties() { return properties; } public void setProperties( Properties properties ) { this.properties= properties; } } maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java0000644000175000017500000001764311050276167031332 0ustar tonytony/* * 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.invoker; import java.io.File; import java.io.Reader; import java.util.Arrays; import java.util.List; import java.util.Properties; import org.apache.maven.model.Scm; import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.settings.Settings; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; /** * @author olamy * @since 22 nov. 07 * @version $Id: InterpolationTest.java 685126 2008-08-12 12:05:11Z bentmann $ */ public class InterpolationTest extends AbstractMojoTestCase { protected MavenProjectStub buildMavenProjectStub() { ExtendedMavenProjectStub project = new ExtendedMavenProjectStub(); project.setVersion( "1.0-SNAPSHOT" ); project.setArtifactId( "foo" ); project.setGroupId( "bar" ); Properties properties = new Properties(); properties.put( "fooOnProject", "barOnProject" ); project.setProperties( properties ); Scm scm = new Scm(); scm.setConnection( "http://blabla" ); project.setScm( scm ); return project; } public void testCompositeMap() throws Exception { Properties properties = new Properties(); properties.put( "foo", "bar" ); properties.put( "version", "2.0-SNAPSHOT" ); CompositeMap compositeMap = new CompositeMap( buildMavenProjectStub(), properties ); assertEquals( "1.0-SNAPSHOT", compositeMap.get( "pom.version" ) ); assertEquals( "bar", compositeMap.get( "foo" ) ); assertEquals( "bar", compositeMap.get( "pom.groupId" ) ); assertEquals( "http://blabla", compositeMap.get( "pom.scm.connection" ) ); assertEquals( "barOnProject", compositeMap.get( "fooOnProject" ) ); } public void testInterpolationGoalsFile() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" ); setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); Properties properties = new Properties(); properties.put( "cleanProps", "clean" ); properties.put( "version", "2.0-SNAPSHOT" ); setVariableValueToObject( invokerMojo, "interpolationsProperties", properties ); String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation"; List goals = invokerMojo.getGoals( new File( dirPath ) ); assertEquals( goals.toString(), 2, goals.size() ); assertEquals( "clean", goals.get( 0 ) ); assertEquals( "bar:foo:1.0-SNAPSHOT:mygoal", goals.get( 1 ) ); } public void testPomInterpolation() throws Exception { Reader reader = null; File interpolatedPomFile = null; try { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" ); setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); Properties properties = new Properties(); properties.put( "foo", "bar" ); properties.put( "version", "2.0-SNAPSHOT" ); setVariableValueToObject( invokerMojo, "interpolationsProperties", properties ); String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation"; interpolatedPomFile = new File( getBasedir(), "target/interpolated-pom.xml" ); invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile ); reader = ReaderFactory.newXmlReader( interpolatedPomFile ); String content = IOUtil.toString( reader ); assertTrue( content.indexOf( "bar" ) > 0 ); reader.close(); // recreate it to test delete if exists before creation invokerMojo.buildInterpolatedFile( new File( dirPath, "pom.xml" ), interpolatedPomFile ); reader = ReaderFactory.newXmlReader( interpolatedPomFile ); content = IOUtil.toString( reader ); assertTrue( content.indexOf( "bar" ) > 0 ); reader.close(); } finally { IOUtil.close( reader ); } } public void testProfilesFromFile() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() ); setVariableValueToObject( invokerMojo, "profilesFile", "profiles.txt" ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file"; List profiles = invokerMojo.getProfiles( new File( dirPath ) ); assertEquals( 2, profiles.size() ); assertTrue( profiles.contains( "foo" ) ); } public void testEmptyProfilesFromFile() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() ); setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) ); setVariableValueToObject( invokerMojo, "profilesFile", "emptyProfiles.txt" ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file"; List profiles = invokerMojo.getProfiles( new File( dirPath ) ); assertFalse( profiles.contains( "zloug" ) ); assertEquals( 0, profiles.size() ); } public void testProfilesWithNoFile() throws Exception { InvokerMojo invokerMojo = new InvokerMojo(); setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) ); setVariableValueToObject( invokerMojo, "profilesFile", "zorglubProfiles.txt" ); setVariableValueToObject( invokerMojo, "settings", new Settings() ); String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file"; List profiles = invokerMojo.getProfiles( new File( dirPath ) ); assertTrue( profiles.contains( "zloug" ) ); assertEquals( 1, profiles.size() ); } } ././@LongLink0000000000000000000000000000015000000000000011561 Lustar rootrootmaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/GroovyScriptInterpreterTest.javamaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/GroovyScriptInterpreterTest.j0000644000175000017500000000426411046715361032703 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.ByteArrayOutputStream; import java.io.PrintStream; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; /** * Tests the Groovy interpreter facade. * * @author Benjamin Bentmann * @version $Id: GroovyScriptInterpreterTest.java 683781 2008-08-08 01:01:37Z bentmann $ */ public class GroovyScriptInterpreterTest extends TestCase { public void testEvaluateScript() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ScriptInterpreter interpreter = new GroovyScriptInterpreter(); assertEquals( Boolean.TRUE, interpreter.evaluateScript( "print \"Test\"\nreturn true", null, null, new PrintStream( out ) ) ); assertEquals( "Test", out.toString() ); } public void testEvaluateScriptVars() throws Exception { Map vars = new HashMap(); vars.put( "testVar", "data" ); ByteArrayOutputStream out = new ByteArrayOutputStream(); ScriptInterpreter interpreter = new GroovyScriptInterpreter(); assertEquals( Boolean.TRUE, interpreter.evaluateScript( "print testVar\nreturn true", null, vars, new PrintStream( out ) ) ); assertEquals( "data", out.toString() ); } } ././@LongLink0000000000000000000000000000015300000000000011564 Lustar rootrootmaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreterTest.javamaven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreterTes0000644000175000017500000000433511046715361032636 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.ByteArrayOutputStream; import java.io.PrintStream; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; /** * Tests the BeanShell interpreter facade. * * @author Benjamin Bentmann * @version $Id: BeanShellScriptInterpreterTest.java 683781 2008-08-08 01:01:37Z bentmann $ */ public class BeanShellScriptInterpreterTest extends TestCase { public void testEvaluateScript() throws Exception { ByteArrayOutputStream out = new ByteArrayOutputStream(); ScriptInterpreter interpreter = new BeanShellScriptInterpreter(); assertEquals( Boolean.TRUE, interpreter.evaluateScript( "System.out.print(\"Test\"); return true;", null, null, new PrintStream( out ) ) ); assertEquals( "Test", out.toString() ); } public void testEvaluateScriptVars() throws Exception { Map vars = new HashMap(); vars.put( "testVar", "data" ); ByteArrayOutputStream out = new ByteArrayOutputStream(); ScriptInterpreter interpreter = new BeanShellScriptInterpreter(); assertEquals( Boolean.TRUE, interpreter.evaluateScript( "System.out.print(testVar); return true;", null, vars, new PrintStream( out ) ) ); assertEquals( "data", out.toString() ); } } maven-invoker-plugin-1.5/src/test/java/org/apache/maven/plugin/invoker/InvokerPropertiesTest.java0000644000175000017500000002213111134630474032157 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.Arrays; import java.util.Collections; import java.util.Properties; import org.apache.maven.shared.invoker.DefaultInvocationRequest; import org.apache.maven.shared.invoker.InvocationRequest; import junit.framework.TestCase; /** * Tests the invoker properties facade. * * @author Benjamin Bentmann * @version $Id: InvokerPropertiesTest.java 735456 2009-01-18 13:40:12Z bentmann $ */ public class InvokerPropertiesTest extends TestCase { public void testConstructorNullSafe() throws Exception { InvokerProperties facade = new InvokerProperties( null ); assertNotNull( facade.getProperties() ); } public void testGetInvokerProperty() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); assertNull( facade.get( "undefined-key", 0 ) ); props.setProperty( "key", "value" ); assertEquals( "value", facade.get( "key", 1 ) ); props.setProperty( "key.1", "another-value" ); assertEquals( "another-value", facade.get( "key", 1 ) ); assertEquals( "value", facade.get( "key", 2 ) ); } public void testIsExpectedResult() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); assertTrue( facade.isExpectedResult( 0, 0 ) ); assertFalse( facade.isExpectedResult( 1, 0 ) ); props.setProperty( "invoker.buildResult", "success" ); assertTrue( facade.isExpectedResult( 0, 0 ) ); assertFalse( facade.isExpectedResult( 1, 0 ) ); props.setProperty( "invoker.buildResult", "failure" ); assertFalse( facade.isExpectedResult( 0, 0 ) ); assertTrue( facade.isExpectedResult( 1, 0 ) ); } public void testConfigureRequestGoals() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setGoals( Collections.singletonList( "test" ) ); facade.configureInvocation( request, 0 ); assertEquals( Collections.singletonList( "test" ), request.getGoals() ); props.setProperty( "invoker.goals", "verify" ); facade.configureInvocation( request, 0 ); assertEquals( Collections.singletonList( "verify" ), request.getGoals() ); props.setProperty( "invoker.goals", " " ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[0] ), request.getGoals() ); props.setProperty( "invoker.goals", " clean , test verify " ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getGoals() ); props.setProperty( "invoker.goals", "" ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[0] ), request.getGoals() ); } public void testConfigureRequestProfiles() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setProfiles( Collections.singletonList( "test" ) ); facade.configureInvocation( request, 0 ); assertEquals( Collections.singletonList( "test" ), request.getProfiles() ); props.setProperty( "invoker.profiles", "verify" ); facade.configureInvocation( request, 0 ); assertEquals( Collections.singletonList( "verify" ), request.getProfiles() ); props.setProperty( "invoker.profiles", " " ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[0] ), request.getProfiles() ); props.setProperty( "invoker.profiles", " clean , test verify ," ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getProfiles() ); props.setProperty( "invoker.profiles", "" ); facade.configureInvocation( request, 0 ); assertEquals( Arrays.asList( new String[0] ), request.getProfiles() ); } public void testConfigureRequestProject() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); File tempPom = File.createTempFile( "maven-invoker-plugin-test", ".pom" ); File tempDir = tempPom.getParentFile(); request.setBaseDirectory( tempDir ); facade.configureInvocation( request, 0 ); assertEquals( tempDir, request.getBaseDirectory() ); assertEquals( null, request.getPomFile() ); props.setProperty( "invoker.project", tempPom.getName() ); request.setBaseDirectory( tempDir ); facade.configureInvocation( request, 0 ); assertEquals( tempDir, request.getBaseDirectory() ); assertEquals( tempPom, request.getPomFile() ); props.setProperty( "invoker.project", "" ); request.setBaseDirectory( tempDir ); facade.configureInvocation( request, 0 ); assertEquals( tempDir, request.getBaseDirectory() ); assertEquals( null, request.getPomFile() ); tempPom.delete(); } public void testConfigureRequestMavenOpts() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setMavenOpts( "default" ); facade.configureInvocation( request, 0 ); assertEquals( "default", request.getMavenOpts() ); props.setProperty( "invoker.mavenOpts", "-Xmx512m" ); facade.configureInvocation( request, 0 ); assertEquals( "-Xmx512m", request.getMavenOpts() ); } public void testConfigureRequestFailureBehavior() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setFailureBehavior( "fail-at-end" ); facade.configureInvocation( request, 0 ); assertEquals( "fail-at-end", request.getFailureBehavior() ); props.setProperty( "invoker.failureBehavior", "fail-never" ); facade.configureInvocation( request, 0 ); assertEquals( "fail-never", request.getFailureBehavior() ); } public void testConfigureRequestRecursion() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setRecursive( true ); facade.configureInvocation( request, 0 ); assertTrue( request.isRecursive() ); request.setRecursive( false ); facade.configureInvocation( request, 0 ); assertFalse( request.isRecursive() ); props.setProperty( "invoker.nonRecursive", "true" ); facade.configureInvocation( request, 0 ); assertFalse( request.isRecursive() ); props.setProperty( "invoker.nonRecursive", "false" ); facade.configureInvocation( request, 0 ); assertTrue( request.isRecursive() ); } public void testConfigureRequestOffline() throws Exception { Properties props = new Properties(); InvokerProperties facade = new InvokerProperties( props ); InvocationRequest request = new DefaultInvocationRequest(); request.setOffline( true ); facade.configureInvocation( request, 0 ); assertTrue( request.isOffline() ); request.setOffline( false ); facade.configureInvocation( request, 0 ); assertFalse( request.isOffline() ); props.setProperty( "invoker.offline", "true" ); facade.configureInvocation( request, 0 ); assertTrue( request.isOffline() ); props.setProperty( "invoker.offline", "false" ); facade.configureInvocation( request, 0 ); assertFalse( request.isOffline() ); } } maven-invoker-plugin-1.5/src/test/resources/0000755000175000017500000000000011623526250017762 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/0000755000175000017500000000000011623526250020741 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/dummy/0000755000175000017500000000000011623526250022074 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/dummy/pom.xml0000644000175000017500000000236411011272362023407 0ustar tonytony 4.0.0 org.apache.maven.test unit pom 0.1-SNAPSHOT @foo@ maven-invoker-plugin-1.5/src/test/resources/unit/interpolation/0000755000175000017500000000000011623526250023630 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/interpolation/pom.xml0000644000175000017500000000236411011272362025143 0ustar tonytony 4.0.0 org.apache.maven.test unit pom 0.1-SNAPSHOT @foo@ maven-invoker-plugin-1.5/src/test/resources/unit/interpolation/goals.txt0000644000175000017500000000010511011272362025463 0ustar tonytony${cleanProps} ${pom.groupId}:${pom.artifactId}:${pom.version}:mygoalmaven-invoker-plugin-1.5/src/test/resources/unit/profiles-from-file/0000755000175000017500000000000011623526250024442 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/profiles-from-file/emptyProfiles.txt0000644000175000017500000000000011011272362030024 0ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/profiles-from-file/profiles.txt0000644000175000017500000000001111011272362027007 0ustar tonytonyfoo, bar maven-invoker-plugin-1.5/src/test/resources/unit/goals-from-file/0000755000175000017500000000000011623526250023724 5ustar tonytonymaven-invoker-plugin-1.5/src/test/resources/unit/goals-from-file/verify.bsh0000644000175000017500000000271611011272362025725 0ustar tonytony /* * 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 org.codehaus.plexus.util.*; boolean result = true; try { File build = new File ( basedir, "build.log" ); if ( !build.exists() || build.isDirectory() ) { System.err.println( "build.log file is missing or a directory." ); return false; } FileInputStream fis = new FileInputStream ( build ); String buildContent = IOUtil.toString ( fis ); int indexOf = buildContent.indexOf( "BUILD SUCCESSFUL" ); if ( indexOf < 0) { System.err.println( "build.log doesn't contains BUILD SUCCESSFUL" ); } } catch( IOException e ) { e.printStackTrace(); result = false; } return result; maven-invoker-plugin-1.5/src/test/resources/unit/goals-from-file/pom.xml0000644000175000017500000000224611011272362025236 0ustar tonytony 4.0.0 org.apache.maven.test unit pom 0.1-SNAPSHOT maven-invoker-plugin-1.5/src/test/resources/unit/goals-from-file/goals.txt0000644000175000017500000000002411011272362025557 0ustar tonytonyclean , test installmaven-invoker-plugin-1.5/src/test/resources/unit/goals-from-file/validate-goal.txt0000644000175000017500000000001011011272362027156 0ustar tonytonyvalidatemaven-invoker-plugin-1.5/src/it/0000755000175000017500000000000011623526251015406 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/0000755000175000017500000000000011623526251021617 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/verify.bsh0000644000175000017500000000244411252273270023623 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; boolean check( String project, boolean filtered ) { File pomFile = new File( basedir, "target/it/" + project + "/pom.xml" ); System.out.println( "Checking for existence of " + ( filtered ? "" : "un" ) + "filtered POM: " + pomFile ); if ( !pomFile.exists() ) { System.out.println( "FAILED!" ); return false; } String xml = FileUtils.fileRead( pomFile, "UTF-8" ); String[] values = { "pom-filtering-reactor", }; for ( String value : values ) { System.out.println( "Checking for " + ( filtered ? "occurrence" : "absence" ) + " of: " + value ); if ( ( filtered && xml.indexOf( value ) < 0 ) || ( !filtered && xml.indexOf( value ) >= 0 ) ) { System.out.println( "FAILED!" ); return false; } } return true; } try { return check( "mod2-parent", true ) && check( "mod2-parent/mod2", true ) && check( "mod2-parent/mod1-parent", true ) && check( "mod2-parent/mod1", true ) && check( "mod2-parent/mod3", true) && check( "mod2-parent/mod1/src/it", false ); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/pom.xml0000644000175000017500000000426611137127646023151 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker pom-filtering-reactor 1.0-SNAPSHOT pom Test to check that POM filtering includes all parents/modules of the invoked project and not only the execution root. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/0000755000175000017500000000000011623526251022406 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/0000755000175000017500000000000011623526251023022 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/0000755000175000017500000000000011623526251025152 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/pom.xml0000644000175000017500000000301511252273270026464 0ustar tonytony 4.0.0 test mod2-parent 0.1-SNAPSHOT pom mod1 mod2 UTF-8 @pom.artifactId@ minvoker-93 mod3 maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/0000755000175000017500000000000011623526251027301 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1-parent/pom.xml0000644000175000017500000000245211056317365030625 0ustar tonytony 4.0.0 test mod1-parent 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/0000755000175000017500000000000011623526251026013 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod2/pom.xml0000644000175000017500000000264511056317365027343 0ustar tonytony 4.0.0 test mod2-parent 0.1-SNAPSHOT test mod2 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/0000755000175000017500000000000011623526251026014 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/pom.xml0000644000175000017500000000272511252273270027335 0ustar tonytony 4.0.0 test mod1-parent 0.1-SNAPSHOT ../mod1-parent test mod3 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/0000755000175000017500000000000011623526251026603 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/0000755000175000017500000000000011623526251027217 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod3/src/it/pom.xml0000644000175000017500000000261211056317365030541 0ustar tonytony 4.0.0 test unfiltered 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/0000755000175000017500000000000011623526251026012 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/pom.xml0000644000175000017500000000272511056317365027341 0ustar tonytony 4.0.0 test mod1-parent 0.1-SNAPSHOT ../mod1-parent test mod1 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/0000755000175000017500000000000011623526251026601 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/0000755000175000017500000000000011623526251027215 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-reactor/src/it/mod2-parent/mod1/src/it/pom.xml0000644000175000017500000000261211056317365030537 0ustar tonytony 4.0.0 test unfiltered 0.1-SNAPSHOT pom UTF-8 @pom.artifactId@ maven-invoker-plugin-1.5/src/it/pom-less-invocation/0000755000175000017500000000000011623526251021314 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-less-invocation/verify.bsh0000644000175000017500000000124411047373475023327 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File itDir = new File( basedir, "target/it" ); if ( !itDir.isDirectory() ) { System.out.println( "IT directory not existent: " + itDir ); return false; } String[] paths = { "no-pom", "no-pom/build.log", }; for ( String path : paths ) { File file = new File( itDir, path ); if ( !file.exists() ) { System.out.println( "Expected file/directory not existent: " + file ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/pom-less-invocation/pom.xml0000644000175000017500000000421611137127646022641 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker pom-less-invocation 1.0-SNAPSHOT pom Test to check for support to launch Maven on a mere directory, i.e. without a POM UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it no-pom --version integration-test initialize run maven-invoker-plugin-1.5/src/it/pom-less-invocation/src/0000755000175000017500000000000011623526251022103 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-less-invocation/src/it/0000755000175000017500000000000011623526251022517 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-less-invocation/src/it/no-pom/0000755000175000017500000000000011623526251023724 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-less-invocation/src/it/no-pom/workaround.txt0000644000175000017500000000012711047373475026670 0ustar tonytonyThis file ensures the directory is cloned, to be deleted once MINVOKER-48 is released. maven-invoker-plugin-1.5/src/it/settings-auto-exclude/0000755000175000017500000000000011623526251021643 5ustar tonytonymaven-invoker-plugin-1.5/src/it/settings-auto-exclude/pom.xml0000644000175000017500000000511511137127646023167 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker settings-auto-exclude 1.0-SNAPSHOT pom Test to check that the custom settings.xml is automatically excluded from the project scanner. This is a convenience feature to support the following common directory layout src/it/ project1/ project2/ settings.xml in combination with the POM include pattern "*" required to select POM-less directories. Without excluding settings.xml, it would be considered a POM and cause a build failure. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ * src/it/settings.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/settings-auto-exclude/src/0000755000175000017500000000000011623526251022432 5ustar tonytonymaven-invoker-plugin-1.5/src/it/settings-auto-exclude/src/it/0000755000175000017500000000000011623526251023046 5ustar tonytonymaven-invoker-plugin-1.5/src/it/settings-auto-exclude/src/it/settings.xml0000644000175000017500000000320411056317365025433 0ustar tonytony it-repo true local.central file://@localRepository@ true true local.central file://@localRepository@ true true maven-invoker-plugin-1.5/src/it/settings-auto-exclude/src/it/project/0000755000175000017500000000000011623526251024514 5ustar tonytonymaven-invoker-plugin-1.5/src/it/settings-auto-exclude/src/it/project/pom.xml0000644000175000017500000000240211056317365026033 0ustar tonytony 4.0.0 test project 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-errors/0000755000175000017500000000000011623526251020224 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-errors/verify.bsh0000644000175000017500000000125411137101662022223 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile; touchFile = new File( basedir, "src/it/beanshell/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { throw new FileNotFoundException( "Did not find marker file: " + touchFile ); } touchFile = new File( basedir, "src/it/groovy/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { throw new FileNotFoundException( "Did not find marker file: " + touchFile ); } return true; maven-invoker-plugin-1.5/src/it/script-errors/pom.xml0000644000175000017500000000454311137127646021554 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-errors 1.0-SNAPSHOT pom Test to check that any kind of error from the script, i.e. both java.lang.Exception and java.lang.Error, is caught by the interpreter facade and does not go up to the main build (MINVOKER-78). UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ */pom.xml setup verify validate true integration-test initialize run maven-invoker-plugin-1.5/src/it/script-errors/src/0000755000175000017500000000000011623526251021013 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-errors/src/it/0000755000175000017500000000000011623526251021427 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-errors/src/it/beanshell/0000755000175000017500000000000011623526251023364 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-errors/src/it/beanshell/pom.xml0000644000175000017500000000240411137101662024674 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-errors/src/it/beanshell/setup.bsh0000644000175000017500000000046611137101662025223 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); // BeanShell does not allow us to simply throw an error, so will we try to trigger an OutOfMemoryError... long[] arr = new long[ Integer.MAX_VALUE ]; maven-invoker-plugin-1.5/src/it/script-errors/src/it/groovy/0000755000175000017500000000000011623526251022754 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-errors/src/it/groovy/pom.xml0000644000175000017500000000240111137101662024261 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-errors/src/it/groovy/setup.groovy0000644000175000017500000000036611137101662025363 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ) touchFile.createNewFile() if ( true ) throw new AssertionError( "This should not cause the main build to fail" ) maven-invoker-plugin-1.5/src/it/fail-ignore/0000755000175000017500000000000011623526250017601 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore/pom.xml0000644000175000017500000000433311137127646021127 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-ignore 1.0-SNAPSHOT pom Test to check that a failure in the forked Maven builds is ignored. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml invalid-phase-to-fail-build true integration-test initialize run maven-invoker-plugin-1.5/src/it/fail-ignore/src/0000755000175000017500000000000011623526250020370 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore/src/it/0000755000175000017500000000000011623526250021004 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore/src/it/project/0000755000175000017500000000000011623526250022452 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore/src/it/project/pom.xml0000644000175000017500000000240611057057065023775 0ustar tonytony 4.0.0 test fail-ignore 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/local-repo-default/0000755000175000017500000000000011623526250021064 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-default/verify.bsh0000644000175000017500000000372411047543322023073 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File badRepoDir = new File( basedir, "target/bad-repo" ); if ( badRepoDir.exists() ) { System.out.println( "Sub build used wrong local repository (from its settings.xml): " + badRepoDir ); return false; } /* * NOTE: This relies heavily on the Invoker Plugin's configuration of our parent build, not nice but until MINVOKER-49 * is available here, we have no other way of getting the path. */ File localRepoPathOfThisBuild = new File( basedir.getParentFile().getParentFile(), "local-repo" ); System.out.println("Local repository of this build: " + localRepoPathOfThisBuild); File textFile = new File( basedir, "src/it/project/target/local-repo-path.txt" ); BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( textFile ), "UTF-8" ) ); File localRepoPathOfSubBuild = new File ( reader.readLine() ); reader.close(); System.out.println("Local repository of sub build: " + localRepoPathOfSubBuild); /* * This is partly a sanity check of the Maven core (i.e. its MavenSettingsBuilder) which should ensure * ${settings.localRepository} == ${maven.repo.local} * This IT is run with maven.repo.local but the Invoker Plugin passes settings.localRepository down to the sub build * so these paths must match. */ if ( !localRepoPathOfThisBuild.equals( localRepoPathOfSubBuild ) ) { System.out.println( "Sub build used wrong local repository: " + localRepoPathOfSubBuild ); return false; } File installedFile = new File( localRepoPathOfThisBuild, "test/local-repo-default/0.1-SNAPSHOT/local-repo-default-0.1-SNAPSHOT.pom" ); if ( !installedFile.isFile() ) { System.out.println( "Installed file missing in local repo: " + installedFile ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/local-repo-default/pom.xml0000644000175000017500000000432611137127646022414 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker local-repo-default 1.0-SNAPSHOT pom Test to check for MINVOKER-47, i.e. local repo path given by IT settings.xml must be ignored even if plugin configuration does not specify a custom location. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ */pom.xml src/it/settings.xml install integration-test initialize run maven-invoker-plugin-1.5/src/it/local-repo-default/src/0000755000175000017500000000000011623526250021653 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-default/src/it/0000755000175000017500000000000011623526250022267 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-default/src/it/settings.xml0000644000175000017500000000345411056317365024664 0ustar tonytony @project.build.directory@/bad-repo it-repo true local.central file://@localRepository@ true true local.central file://@localRepository@ true true maven-invoker-plugin-1.5/src/it/local-repo-default/src/it/project/0000755000175000017500000000000011623526250023735 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-default/src/it/project/pom.xml0000644000175000017500000000241511056317365025261 0ustar tonytony 4.0.0 test local-repo-default 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/local-repo-default/src/it/project/postbuild.bsh0000644000175000017500000000077311047543322026446 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // just dump our local repo path for verification by the parent build File textFile = new File( basedir, "target/local-repo-path.txt" ); textFile.getParentFile().mkdirs(); Writer writer = new OutputStreamWriter( new FileOutputStream( textFile ), "UTF-8" ); writer.write( localRepositoryPath.getAbsolutePath() ); writer.close(); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/integration-test-never-fails/0000755000175000017500000000000011623526250023116 5ustar tonytonymaven-invoker-plugin-1.5/src/it/integration-test-never-fails/verify.bsh0000644000175000017500000000077211054073172025124 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/integration-test-never-fails/pom.xml0000644000175000017500000000431111242033203024416 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker integration-test-never-fails 1.0-SNAPSHOT pom Test to check that a failure in the forked Maven build does not fail the parent build. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize integration-test maven-invoker-plugin-1.5/src/it/integration-test-never-fails/src/0000755000175000017500000000000011623526250023705 5ustar tonytonymaven-invoker-plugin-1.5/src/it/integration-test-never-fails/src/it/0000755000175000017500000000000011623526250024321 5ustar tonytonymaven-invoker-plugin-1.5/src/it/integration-test-never-fails/src/it/project/0000755000175000017500000000000011623526250025767 5ustar tonytonymaven-invoker-plugin-1.5/src/it/integration-test-never-fails/src/it/project/prebuild.bsh0000644000175000017500000000023711154730610030271 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/integration-test-never-fails/src/it/project/pom.xml0000644000175000017500000000247211056317365027316 0ustar tonytony 99.0.0 test fail-build 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/invocation-offline/0000755000175000017500000000000011623526250021176 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-offline/verify.bsh0000644000175000017500000000057011137127476023211 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; // sanity check to make sure the builds were actually run File repoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for existence of test repo: " + repoDir ); if ( !repoDir.exists() ) { throw new FileNotFoundException( "Missing repository directory: " + repoDir ); } return true; maven-invoker-plugin-1.5/src/it/invocation-offline/pom.xml0000644000175000017500000000426611137127646022531 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker invocation-offline 1.0-SNAPSHOT pom Test to check for usage of offline mode. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo */pom.xml src/it/settings.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/invocation-offline/src/0000755000175000017500000000000011623526250021765 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-offline/src/it/0000755000175000017500000000000011623526250022401 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-offline/src/it/settings.xml0000644000175000017500000000366111072450364024771 0ustar tonytony it-repo true local.central file://@invoker.repo.local@ true true local.central file://@invoker.repo.local@ true true maven-invoker-plugin-1.5/src/it/invocation-offline/src/it/project/0000755000175000017500000000000011623526250024047 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-offline/src/it/project/invoker.properties0000644000175000017500000000032011072450364027635 0ustar tonytony# First run if offline mode which should fail to download the Clean Plugin invoker.goals.1 = clean invoker.offline.1 = true invoker.buildResult.1 = failure # Now again in online mode invoker.goals.2 = clean maven-invoker-plugin-1.5/src/it/invocation-offline/src/it/project/pom.xml0000644000175000017500000000272111072450364025366 0ustar tonytony 4.0.0 test invocation-offline 0.1-SNAPSHOT jar UTF-8 junit junit 3.8.2 test maven-invoker-plugin-1.5/src/it/pom-filtering/0000755000175000017500000000000011623526250020161 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering/verify.bsh0000644000175000017500000000403511123250333022154 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { File pomFile = new File( basedir, "target/it/project/pom.xml" ); System.out.println( "Checking for existence of original IT POM: " + pomFile ); if ( !pomFile.exists() ) { System.out.println( "FAILED!" ); return false; } pomFile = new File( basedir, "target/it/project/target/classes/pom.xml" ); System.out.println( "Checking for existence of interpolated IT POM: " + pomFile ); if ( !pomFile.exists() ) { System.out.println( "FAILED!" ); return false; } String xml = FileUtils.fileRead( pomFile, "UTF-8" ); String[] values = { "${project.version}", "1.0-SNAPSHOT", "PROPERTY-FROM-PLUGIN-CONFIG", "PROPERTY-FROM-PROPERTIES-SECTION", "PASSED", "PASSED", "PASSED", "PASSED", "PASSED", "file:///", "file:///", }; for ( String value : values ) { System.out.println( "Checking for occurrence of: " + value ); if ( xml.indexOf( value ) < 0 ) { System.out.println( "FAILED!" ); return false; } } String[] badValues = { "@basedir@", "FAILED", "@baseurl@", "FAILED", "@localRepository@", "@localRepositoryUrl@", }; for ( String value : badValues ) { System.out.println( "Checking for absence of: " + value ); if ( xml.indexOf( value ) >= 0 ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/pom-filtering/pom.xml0000644000175000017500000000541511137127646021511 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker pom-filtering 1.0-SNAPSHOT pom PASSED Test to check for proper filtering of IT POMs UTF-8 PROPERTY-FROM-PROPERTIES-SECTION FAILED org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml process-resources PROPERTY-FROM-PLUGIN-CONFIG PASSED FAILED PASSED PASSED FAILED FAILED integration-test initialize run maven-invoker-plugin-1.5/src/it/pom-filtering/src/0000755000175000017500000000000011623526250020750 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering/src/it/0000755000175000017500000000000011623526250021364 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering/src/it/settings.xml0000644000175000017500000000320411056317365023752 0ustar tonytony it-repo true local.central file://@localRepository@ true true local.central file://@localRepository@ true true maven-invoker-plugin-1.5/src/it/pom-filtering/src/it/project/0000755000175000017500000000000011623526250023032 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering/src/it/project/pom.xml0000644000175000017500000000543311123250333024343 0ustar tonytony 4.0.0 test pom-filtering 0.1-SNAPSHOT jar UTF-8 ${project.version} @project.version@ @propertyFromPluginConfig@ @propertyFromPropertiesSection@ @project-is-not-the-pom.version@ @project.name@ @pom.name@ @itProperty@ @project.nonExistingPomValue@ @basedir@ @baseurl@ @localRepository@ @localRepositoryUrl@ ${basedir} false *.xml maven-resources-plugin 2.2 maven-invoker-plugin-1.5/src/it/fail-build/0000755000175000017500000000000011623526251017416 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build/verify.bsh0000644000175000017500000000077211054073172021423 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/fail-build/invoker.properties0000644000175000017500000000003611137127646023215 0ustar tonytonyinvoker.buildResult = failure maven-invoker-plugin-1.5/src/it/fail-build/pom.xml0000644000175000017500000000424711137127646020747 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-build 1.0-SNAPSHOT pom Test to check that a failure in the forked Maven build fails the parent build, too. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/fail-build/src/0000755000175000017500000000000011623526251020205 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build/src/it/0000755000175000017500000000000011623526251020621 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build/src/it/project/0000755000175000017500000000000011623526251022267 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build/src/it/project/prebuild.bsh0000644000175000017500000000023711154730610024570 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/fail-build/src/it/project/pom.xml0000644000175000017500000000253611242337166023614 0ustar tonytony 99.0.0 test fail-build 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/script-accessibility/0000755000175000017500000000000011623526250021536 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/invoker.properties0000644000175000017500000000003611137127646025336 0ustar tonytonyinvoker.goals = clean compile maven-invoker-plugin-1.5/src/it/script-accessibility/pom.xml0000644000175000017500000000436011137127646023064 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-accessibility 1.0-SNAPSHOT jar Test to check for accessibility of non-public fields/methods in hook scripts. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ */pom.xml setup verify validate true integration-test compile run maven-invoker-plugin-1.5/src/it/script-accessibility/src/0000755000175000017500000000000011623526250022325 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/it/0000755000175000017500000000000011623526250022741 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/it/beanshell/0000755000175000017500000000000011623526250024676 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/it/beanshell/verify.bsh0000644000175000017500000000026211154730610026674 0ustar tonytonyimport org.MyClass; System.out.println( MyClass.PUBLIC ); System.out.println( MyClass.PROTECTED ); System.out.println( MyClass.PACKAGE ); System.out.println( MyClass.PRIVATE ); maven-invoker-plugin-1.5/src/it/script-accessibility/src/it/beanshell/pom.xml0000644000175000017500000000240411070413546026212 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-accessibility/src/it/groovy/0000755000175000017500000000000011623526250024266 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/it/groovy/verify.groovy0000644000175000017500000000016611154730610027040 0ustar tonytonyimport org.MyClass; println MyClass.PUBLIC println MyClass.PROTECTED println MyClass.PACKAGE println MyClass.PRIVATE maven-invoker-plugin-1.5/src/it/script-accessibility/src/it/groovy/pom.xml0000644000175000017500000000240111070413546025577 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-accessibility/src/main/0000755000175000017500000000000011623526250023251 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/main/java/0000755000175000017500000000000011623526250024172 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/main/java/org/0000755000175000017500000000000011623526250024761 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-accessibility/src/main/java/org/MyClass.java0000644000175000017500000000037311070413546027201 0ustar tonytonypackage org; public class MyClass { public static final String PUBLIC = "public"; protected static final String PROTECTED = "protected"; static final String PACKAGE = "package"; private static final String PRIVATE = "private"; } maven-invoker-plugin-1.5/src/it/local-repo-path/0000755000175000017500000000000011623526251020375 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-path/verify.bsh0000644000175000017500000000057011137127476022407 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; // sanity check to make sure the builds were actually run File repoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for existence of test repo: " + repoDir ); if ( !repoDir.exists() ) { throw new FileNotFoundException( "Missing repository directory: " + repoDir ); } return true; maven-invoker-plugin-1.5/src/it/local-repo-path/pom.xml0000644000175000017500000000503511255417661021722 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker local-repo-path 1.0-SNAPSHOT jar Test to check for proper filtering of "localRepository" token. UTF-8 org.apache.maven.plugins maven-clean-plugin 2.2 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo */pom.xml src/it/settings.xml org.apache.maven.plugins:maven-clean-plugin:2.2:clean integration-test initialize run maven-invoker-plugin-1.5/src/it/local-repo-path/src/0000755000175000017500000000000011623526251021164 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-path/src/it/0000755000175000017500000000000011623526251021600 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-path/src/it/settings.xml0000644000175000017500000000205311064726676024176 0ustar tonytony sandbox A completely isolated repo to test the interpolation of "localRepository" file://@localRepository@ * maven-invoker-plugin-1.5/src/it/local-repo-path/src/it/project/0000755000175000017500000000000011623526251023246 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-path/src/it/project/pom.xml0000644000175000017500000000237711064726676024610 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/script-context/0000755000175000017500000000000011623526251020374 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-context/verify.bsh0000644000175000017500000000112411137113125022364 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; File touchFile; touchFile = new File( basedir, "src/it/beanshell/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { throw new FileNotFoundException( "Did not find marker file: " + touchFile ); } touchFile = new File( basedir, "src/it/groovy/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { throw new FileNotFoundException( "Did not find marker file: " + touchFile ); } return true; maven-invoker-plugin-1.5/src/it/script-context/pom.xml0000644000175000017500000000433211137127646021720 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-context 1.0-SNAPSHOT pom Test that the hook scripts can share information via a map in the global variable "context" (MINVOKER-79). UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ */pom.xml setup verify validate integration-test initialize run maven-invoker-plugin-1.5/src/it/script-context/src/0000755000175000017500000000000011623526250021162 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-context/src/it/0000755000175000017500000000000011623526251021577 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-context/src/it/beanshell/0000755000175000017500000000000011623526251023534 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-context/src/it/beanshell/verify.bsh0000644000175000017500000000026711251035242025533 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; System.out.println( context ); File touchFile = context.get( "touchFile" ); touchFile.createNewFile(); return true; maven-invoker-plugin-1.5/src/it/script-context/src/it/beanshell/pom.xml0000644000175000017500000000240411137113125025041 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-context/src/it/beanshell/setup.bsh0000644000175000017500000000023711154730610025367 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; context.put( "touchFile", new File( basedir, "touch.txt" ) ); System.out.println( context ); maven-invoker-plugin-1.5/src/it/script-context/src/it/groovy/0000755000175000017500000000000011623526251023124 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-context/src/it/groovy/verify.groovy0000644000175000017500000000024211251035242025665 0ustar tonytonyimport java.io.* import java.util.* import java.util.regex.* println context File touchFile = context.get( "touchFile" ) touchFile.createNewFile() return true maven-invoker-plugin-1.5/src/it/script-context/src/it/groovy/pom.xml0000644000175000017500000000240111137113125024426 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-context/src/it/groovy/setup.groovy0000644000175000017500000000021411154730610025523 0ustar tonytonyimport java.io.* import java.util.* import java.util.regex.* context.put( "touchFile", new File( basedir, "touch.txt" ) ) println context maven-invoker-plugin-1.5/src/it/staging-pom/0000755000175000017500000000000011623526250017632 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-pom/verify.bsh0000644000175000017500000000144611242337166021644 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File itRepoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for existence of: " + itRepoDir ); if ( !itRepoDir.isDirectory() ) { System.out.println( "FAILED!" ); return false; } String[] files = { "test/pom-packaging/1.0-SNAPSHOT/pom-packaging-1.0-SNAPSHOT.pom", }; for ( String file : files ) { File stagedFile = new File( itRepoDir, file ); System.out.println( "Checking for existence of: " + stagedFile ); if ( !stagedFile.isFile() ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/staging-pom/invoker.properties0000644000175000017500000000003511137127646023431 0ustar tonytonyinvoker.goals = clean verify maven-invoker-plugin-1.5/src/it/staging-pom/pom.xml0000644000175000017500000000375311056525057021163 0ustar tonytony 4.0.0 test pom-packaging 1.0-SNAPSHOT pom Test to check for MINVOKER-51, i.e. NPE when packaging is pom. org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo integration-test install org.apache.maven.plugins maven-site-plugin 2.0-beta-7 maven-invoker-plugin-1.5/src/it/staging-pom/src/0000755000175000017500000000000011623526250020421 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-pom/src/site/0000755000175000017500000000000011623526250021365 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-pom/src/site/site.xml0000644000175000017500000000151511056525057023061 0ustar tonytony maven-invoker-plugin-1.5/src/it/skip-install/0000755000175000017500000000000011623526251020020 5ustar tonytonymaven-invoker-plugin-1.5/src/it/skip-install/test.properties0000644000175000017500000000021511147523624023115 0ustar tonytony# NOTE: Skipping from the CLI is the primary use case so we prefer the system property over the direct POM configuration invoker.skip = true maven-invoker-plugin-1.5/src/it/skip-install/verify.bsh0000644000175000017500000000054211147523624022025 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; File itRepoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for absence of: " + itRepoDir ); if ( itRepoDir.isDirectory() ) { throw new IllegalStateException( "Creation of staging repository was not skipped: " + itRepoDir ); return false; } return true; maven-invoker-plugin-1.5/src/it/skip-install/pom.xml0000644000175000017500000000374611147523624021351 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker skip-install 1.0-SNAPSHOT pom Test to check that invoker.skip=true will skip all installations UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ ${project.build.directory}/it-repo integration-test initialize install maven-invoker-plugin-1.5/src/it/fail-prebuild/0000755000175000017500000000000011623526250020124 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-prebuild/verify.bsh0000644000175000017500000000077211054073172022132 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/fail-prebuild/invoker.properties0000644000175000017500000000003611137127646023724 0ustar tonytonyinvoker.buildResult = failure maven-invoker-plugin-1.5/src/it/fail-prebuild/pom.xml0000644000175000017500000000424611137127646021455 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-prebuild 1.0-SNAPSHOT pom Test to check that a failure of the pre-build hook fails the parent build, too. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/fail-prebuild/src/0000755000175000017500000000000011623526250020713 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-prebuild/src/it/0000755000175000017500000000000011623526250021327 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-prebuild/src/it/project/0000755000175000017500000000000011623526250022775 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-prebuild/src/it/project/prebuild.bsh0000644000175000017500000000025611054073172025302 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); return false; maven-invoker-plugin-1.5/src/it/fail-prebuild/src/it/project/pom.xml0000644000175000017500000000241011056317365024314 0ustar tonytony 4.0.0 test fail-prebuild 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/script-interpreter-detection/0000755000175000017500000000000011623526250023226 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-interpreter-detection/verify.bsh0000644000175000017500000000126411051567156025240 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { String[] files = { "src/it/beanshell/target/prebuild.bsh", "src/it/beanshell/target/postbuild.bsh", "src/it/groovy/target/prebuild.groovy", "src/it/groovy/target/postbuild.groovy", }; for ( String file : files ) { File touchFile = new File( basedir, file ); System.out.println( "Checking for existence of: " + touchFile ); if ( !touchFile.isFile() ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/script-interpreter-detection/pom.xml0000644000175000017500000000433411137127646024555 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-interpreter-detection 1.0-SNAPSHOT jar Test to check for detection of script interpreter from file extension. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true */pom.xml prebuild postbuild validate integration-test initialize run maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/0000755000175000017500000000000011623526250024015 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/0000755000175000017500000000000011623526250024431 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/beanshell/0000755000175000017500000000000011623526250026366 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/beanshell/prebuild.bsh0000644000175000017500000000073211051567156030701 0ustar tonytonyimport java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; try { // create touch file so that the parent build can verify whether this script was called File touchFile = new File( basedir, "target/prebuild.bsh" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/beanshell/pom.xml0000644000175000017500000000240411056317365027710 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/beanshell/postbuild.bsh0000644000175000017500000000073311051567156031101 0ustar tonytonyimport java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; try { // create touch file so that the parent build can verify whether this script was called File touchFile = new File( basedir, "target/postbuild.bsh" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/groovy/0000755000175000017500000000000011623526250025756 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/groovy/prebuild.groovy0000644000175000017500000000070411051567156031041 0ustar tonytonyimport java.io.* import java.lang.reflect.* import java.util.* import java.util.regex.* try { // create touch file so that the parent build can verify whether this script was called File touchFile = new File( basedir, "target/prebuild.groovy" ) println "Creating touch file: " + touchFile touchFile.getParentFile().mkdirs() touchFile.createNewFile() } catch( Throwable t ) { t.printStackTrace() return false } return true maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/groovy/pom.xml0000644000175000017500000000240111056317365027275 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-interpreter-detection/src/it/groovy/postbuild.groovy0000644000175000017500000000070511051567156031241 0ustar tonytonyimport java.io.* import java.lang.reflect.* import java.util.* import java.util.regex.* try { // create touch file so that the parent build can verify whether this script was called File touchFile = new File( basedir, "target/postbuild.groovy" ) println "Creating touch file: " + touchFile touchFile.getParentFile().mkdirs() touchFile.createNewFile() } catch( Throwable t ) { t.printStackTrace() return false } return true maven-invoker-plugin-1.5/src/it/skip-run/0000755000175000017500000000000011623526251017156 5ustar tonytonymaven-invoker-plugin-1.5/src/it/skip-run/test.properties0000644000175000017500000000021511147523624022253 0ustar tonytony# NOTE: Skipping from the CLI is the primary use case so we prefer the system property over the direct POM configuration invoker.skip = true maven-invoker-plugin-1.5/src/it/skip-run/verify.bsh0000644000175000017500000000100111147523624021152 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed NOT run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for non-existence of touch file: " + touchFile ); if ( touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/skip-run/pom.xml0000644000175000017500000000422411147523624020477 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker skip-run 1.0-SNAPSHOT pom Test to check that invoker.skip=true will skip all invocations UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/skip-run/src/0000755000175000017500000000000011623526251017745 5ustar tonytonymaven-invoker-plugin-1.5/src/it/skip-run/src/it/0000755000175000017500000000000011623526251020361 5ustar tonytonymaven-invoker-plugin-1.5/src/it/skip-run/src/it/project/0000755000175000017500000000000011623526251022027 5ustar tonytonymaven-invoker-plugin-1.5/src/it/skip-run/src/it/project/prebuild.bsh0000644000175000017500000000025511147523624024337 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); return true; maven-invoker-plugin-1.5/src/it/skip-run/src/it/project/pom.xml0000644000175000017500000000247411147523624023355 0ustar tonytony 99.0.0 test skip-invoker 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/local-repo-url/0000755000175000017500000000000011623526251020243 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-url/verify.bsh0000644000175000017500000000057011137127476022255 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; // sanity check to make sure the builds were actually run File repoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for existence of test repo: " + repoDir ); if ( !repoDir.exists() ) { throw new FileNotFoundException( "Missing repository directory: " + repoDir ); } return true; maven-invoker-plugin-1.5/src/it/local-repo-url/pom.xml0000644000175000017500000000505311137127646021570 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker local-repo-url 1.0-SNAPSHOT jar Test to check for proper filtering of "localRepositoryUrl" token. UTF-8 org.apache.maven.plugins maven-resources-plugin 2.2 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo */pom.xml src/it/settings.xml org.apache.maven.plugins:maven-resources-plugin:2.2:resources integration-test initialize run maven-invoker-plugin-1.5/src/it/local-repo-url/src/0000755000175000017500000000000011623526251021032 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-url/src/it/0000755000175000017500000000000011623526251021446 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-url/src/it/settings.xml0000644000175000017500000000205211064726676024043 0ustar tonytony sandbox A completely isolated repo to test the interpolation of "localRepositoryUrl" @localRepositoryUrl@ * maven-invoker-plugin-1.5/src/it/local-repo-url/src/it/project/0000755000175000017500000000000011623526251023114 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-url/src/it/project/pom.xml0000644000175000017500000000237711064726676024456 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/settings.xml0000644000175000017500000000511011260477433017771 0ustar tonytony it-repo true @localRepository@ local.central @localRepositoryUrl@ true true apache.snapshots Apache Snapshot Repository http://repository.apache.org/content/groups/snapshots-group/ false true local.central @localRepositoryUrl@ true true apache.snapshots Apache Snapshot Repository http://repository.apache.org/content/groups/snapshots-group/ false true maven-invoker-plugin-1.5/src/it/fail-build-with-verify/0000755000175000017500000000000011623526250021670 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build-with-verify/verify.bsh0000644000175000017500000000077211054073172023676 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/fail-build-with-verify/invoker.properties0000644000175000017500000000003611137127646025470 0ustar tonytonyinvoker.buildResult = failure maven-invoker-plugin-1.5/src/it/fail-build-with-verify/pom.xml0000644000175000017500000000432611242014434023203 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-build 1.0-SNAPSHOT pom Test to check that a failure in the forked Maven build fails the parent build, too. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize integration-test verify maven-invoker-plugin-1.5/src/it/fail-build-with-verify/src/0000755000175000017500000000000011623526250022457 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build-with-verify/src/it/0000755000175000017500000000000011623526250023073 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build-with-verify/src/it/project/0000755000175000017500000000000011623526250024541 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-build-with-verify/src/it/project/prebuild.bsh0000644000175000017500000000023711154730610027043 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/fail-build-with-verify/src/it/project/pom.xml0000644000175000017500000000253611242337166026067 0ustar tonytony 99.0.0 test fail-build 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning-reactor/0000755000175000017500000000000011623526251022140 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/verify.bsh0000644000175000017500000000054011137127476024147 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; // sanity check to make sure the builds were actually run File itDir = new File( basedir, "target/it" ); System.out.println( "Checking for existence of clones: " + itDir ); if ( !itDir.exists() ) { throw new FileNotFoundException( "Missing IT directory: " + itDir ); } return true; maven-invoker-plugin-1.5/src/it/project-cloning-reactor/pom.xml0000644000175000017500000000444511137127646023471 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker project-cloning-reactor 1.0-SNAPSHOT pom Test to check that project cloning includes all parents/modules of the invoked project and not only sub directories. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it aggregator/pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/0000755000175000017500000000000011623526251022727 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/0000755000175000017500000000000011623526251023343 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/module-a/0000755000175000017500000000000011623526251025046 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/module-a/pom.xml0000644000175000017500000000265311056317365026375 0ustar tonytony 4.0.0 test parent 0.1-SNAPSHOT ../parent test module-a 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/parent/0000755000175000017500000000000011623526251024634 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/parent/pom.xml0000644000175000017500000000240111056317365026152 0ustar tonytony 4.0.0 test parent 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/module-b/0000755000175000017500000000000011623526251025047 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/module-b/pom.xml0000644000175000017500000000265311056317365026376 0ustar tonytony 4.0.0 test parent 0.1-SNAPSHOT ../parent test module-b 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/aggregator/0000755000175000017500000000000011623526251025465 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning-reactor/src/it/aggregator/pom.xml0000644000175000017500000000255211056317365027012 0ustar tonytony 4.0.0 test aggregator 0.1-SNAPSHOT pom ../module-a ../module-b/pom.xml UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/0000755000175000017500000000000011623526251021375 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/verify.bsh0000644000175000017500000000203511255230257023376 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { String[] expected = { "src/it/jre-version-match/target/touch.txt", "src/it/os-family-match/target/touch.txt", }; for ( String file : expected ) { File touchFile = new File( basedir, file ); System.out.println( "Checking for existence of: " + touchFile ); if ( !touchFile.isFile() ) { System.out.println( "FAILED!" ); return false; } } String[] unexpected = { "src/it/jre-version-mismatch/target/touch.txt", "src/it/os-family-mismatch/target/touch.txt", }; for ( String file : unexpected ) { File touchFile = new File( basedir, file ); System.out.println( "Checking for absence of: " + touchFile ); if ( touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/selector-conditions/pom.xml0000644000175000017500000000431211255230257022711 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker selector-conditions 1.0-SNAPSHOT jar Test to check for selection of builds based on OS and/or JRE. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true */pom.xml prebuild postbuild validate integration-test initialize run maven-invoker-plugin-1.5/src/it/selector-conditions/src/0000755000175000017500000000000011623526251022164 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/0000755000175000017500000000000011623526251022600 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-mismatch/0000755000175000017500000000000011623526251026303 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-mismatch/invoker.properties0000644000175000017500000000003411255230257032072 0ustar tonytonyinvoker.os.family = nowhere maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-mismatch/pom.xml0000644000175000017500000000237711255230257027630 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-mismatch/postbuild.bsh0000644000175000017500000000044011255230257031003 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-match/0000755000175000017500000000000011623526251025572 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-match/invoker.properties0000644000175000017500000000003511255230257031362 0ustar tonytonyinvoker.os.family = !nowhere maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-match/pom.xml0000644000175000017500000000237711255230257027117 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/os-family-match/postbuild.bsh0000644000175000017500000000044011255230257030272 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-match/0000755000175000017500000000000011623526251026135 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-match/invoker.properties0000644000175000017500000000004711255230257031730 0ustar tonytonyinvoker.java.version = 1.4-, 1.4, 1.5+ maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-match/pom.xml0000644000175000017500000000237711255230257027462 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-match/postbuild.bsh0000644000175000017500000000044011255230257030635 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-mismatch/0000755000175000017500000000000011623526251026646 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-mismatch/invoker.properties0000644000175000017500000000003311255230257032434 0ustar tonytonyinvoker.java.version = 1.2 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-mismatch/pom.xml0000644000175000017500000000237711255230257030173 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/jre-version-mismatch/postbuild.bsh0000644000175000017500000000044011255230257031346 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-match/0000755000175000017500000000000011623526251026463 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-match/invoker.properties0000644000175000017500000000003511267653240032257 0ustar tonytonyinvoker.maven.version = 2.0+ maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-match/pom.xml0000644000175000017500000000237711267653240030014 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-match/postbuild.bsh0000644000175000017500000000044011267653240031167 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-mismatch/0000755000175000017500000000000011623526251027174 5ustar tonytony././@LongLink0000000000000000000000000000014500000000000011565 Lustar rootrootmaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.propertiesmaven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-mismatch/invoker.properties0000644000175000017500000000003411267653240032767 0ustar tonytonyinvoker.maven.version = 1.2 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-mismatch/pom.xml0000644000175000017500000000237711267653240030525 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-conditions/src/it/maven-version-mismatch/postbuild.bsh0000644000175000017500000000044011267653240031700 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/project-cloning/0000755000175000017500000000000011623526250020502 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/verify.bsh0000644000175000017500000000163411047406677022522 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File itDir = new File( basedir, "target/it" ); if ( !itDir.isDirectory() ) { System.out.println( "IT directory not existent: " + itDir ); return false; } // NOTE: It is part of the test design that "module" is a prefix of "module-1" String[] paths = { "module", "module/pom.xml", "module-1", "module-1/pom.xml", "module-1/empty-dir", "module-1/sub-module", "module-1/sub-module/pom.xml", }; for ( String path : paths ) { File file = new File( itDir, path ); if ( !file.exists() ) { System.out.println( "Cloned file/directory not existent: " + file ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/project-cloning/pom.xml0000644000175000017500000000414411137127646022030 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker project-cloning 1.0-SNAPSHOT pom Test to check for proper project cloning UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it **/pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/project-cloning/setup.bsh0000644000175000017500000000037011047406677022352 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File emptyDir = new File( basedir, "src/it/module-1/empty-dir" ); emptyDir.mkdirs(); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/project-cloning/src/0000755000175000017500000000000011623526250021271 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/src/it/0000755000175000017500000000000011623526250021705 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/src/it/module/0000755000175000017500000000000011623526250023172 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/src/it/module/pom.xml0000644000175000017500000000242011056317365024512 0ustar tonytony 4.0.0 org.apache.maven.test unit 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning/src/it/module-1/0000755000175000017500000000000011623526250023330 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/src/it/module-1/pom.xml0000644000175000017500000000242011056317365024650 0ustar tonytony 4.0.0 org.apache.maven.test unit 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-cloning/src/it/module-1/sub-module/0000755000175000017500000000000011623526250025404 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-cloning/src/it/module-1/sub-module/pom.xml0000644000175000017500000000242011056317365026724 0ustar tonytony 4.0.0 org.apache.maven.test unit 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/0000755000175000017500000000000011623526250020712 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/verify.bsh0000644000175000017500000000541711267406352022727 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { String[] expected = { "src/it/script-ret-true/target/touch.txt", "src/it/script-ret-quiet/target/touch.txt", }; for ( String file : expected ) { File touchFile = new File( basedir, file ); System.out.println( "Checking for existence of: " + touchFile ); if ( !touchFile.isFile() ) { System.out.println( "FAILED!" ); return false; } } String[] unexpected = { "src/it/script-ret-false/target/touch.txt", "src/it/script-ret-other/target/touch.txt", "src/it/script-throws/target/touch.txt", }; for ( String file : unexpected ) { File touchFile = new File( basedir, file ); System.out.println( "Checking for absence of: " + touchFile ); if ( touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } String[] success = { "target/invoker-reports/BUILD-script-ret-true.xml", "target/invoker-reports/BUILD-script-ret-quiet.xml", }; for ( String file : success ) { File resultFile = new File( basedir, file ); System.out.println( "Checking build result: " + resultFile ); String xml = FileUtils.fileRead( resultFile, "UTF-8" ); if ( !xml.contains("result=\"success\"") && !xml.contains("result='success'") ) { System.out.println( "FAILED!" ); return false; } } String[] skipped = { "target/invoker-reports/BUILD-script-ret-false.xml", "target/invoker-reports/BUILD-script-ret-other.xml", }; for ( String file : skipped ) { File resultFile = new File( basedir, file ); System.out.println( "Checking build result: " + resultFile ); String xml = FileUtils.fileRead( resultFile, "UTF-8" ); if ( !xml.contains("result=\"skipped\"") && !xml.contains("result='skipped'") ) { System.out.println( "FAILED!" ); return false; } } String[] inerror = { "target/invoker-reports/BUILD-script-throw.xml", }; for ( String file : inerror ) { File resultFile = new File( basedir, file ); System.out.println( "Checking build result: " + resultFile ); String xml = FileUtils.fileRead( resultFile, "UTF-8" ); if ( !xml.contains("result=\"error\"") && !xml.contains("result='error'") ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/selector-scripts/pom.xml0000644000175000017500000000436511267406352022243 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker selector-scripts 1.0-SNAPSHOT jar Test to check for selection of builds based on scripted conditions. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true */pom.xml selector true postbuild validate integration-test initialize run maven-invoker-plugin-1.5/src/it/selector-scripts/src/0000755000175000017500000000000011623526250021501 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/0000755000175000017500000000000011623526250022115 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-false/0000755000175000017500000000000011623526250025301 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-false/pom.xml0000644000175000017500000000237711255230257026627 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-false/selector.bsh0000644000175000017500000000004111267416004027611 0ustar tonytonyimport java.io.*; return false; maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-false/postbuild.bsh0000644000175000017500000000044011255230257030002 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-true/0000755000175000017500000000000011623526250025166 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-true/pom.xml0000644000175000017500000000237711255230257026514 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-true/selector.bsh0000644000175000017500000000004011267416004027475 0ustar tonytonyimport java.io.*; return true; maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-true/postbuild.bsh0000644000175000017500000000045511267406352027701 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); return true; maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-quiet/0000755000175000017500000000000011623526250025336 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-quiet/pom.xml0000644000175000017500000000237711255230257026664 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-quiet/selector.bsh0000644000175000017500000000002311267416004027646 0ustar tonytonyimport java.io.*; maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-quiet/postbuild.bsh0000644000175000017500000000044011255230257030037 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-throw/0000755000175000017500000000000011623526250024562 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-throw/pom.xml0000644000175000017500000000237711255230257026110 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-throw/selector.bsh0000644000175000017500000000010011267416004027066 0ustar tonytonyimport java.io.*; throw new NullPointerException( "Bite me" ); maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-throw/postbuild.bsh0000644000175000017500000000044011255230257027263 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-other/0000755000175000017500000000000011623526250025330 5ustar tonytonymaven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-other/pom.xml0000644000175000017500000000237711255230257026656 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-other/selector.bsh0000644000175000017500000000005011267416004027640 0ustar tonytonyimport java.io.*; return "Some thing"; maven-invoker-plugin-1.5/src/it/selector-scripts/src/it/script-ret-other/postbuild.bsh0000644000175000017500000000044011255230257030031 0ustar tonytonyimport java.io.*; // create touch file so that the parent build can verify whether this build was executed File touchFile = new File( basedir, "target/touch.txt" ); System.out.println( "Creating touch file: " + touchFile ); touchFile.getParentFile().mkdirs(); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/pom-filtering-encoding/0000755000175000017500000000000011623526251021746 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-encoding/verify.bsh0000644000175000017500000000267011051340560023745 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; boolean check( String project, String encoding ) { File pomFile = new File( basedir, "target/it/" + project + "/pom.xml" ); System.out.println( "Checking for existence of original IT POM: " + pomFile ); if ( !pomFile.exists() ) { System.out.println( "FAILED!" ); return false; } pomFile = new File( basedir, "target/it/" + project + "/target/classes/pom.xml" ); System.out.println( "Checking for existence of interpolated IT POM: " + pomFile ); if ( !pomFile.exists() ) { System.out.println( "FAILED!" ); return false; } String xml = FileUtils.fileRead( pomFile, encoding ); String[] values = { "", "\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", "\u00A9\u00AE\u00C4\u00D6\u00DC\u00E4\u00F6\u00FC\u00DF", }; for ( String value : values ) { System.out.println( "Checking for occurrence of: " + value ); if ( xml.indexOf( value ) < 0 ) { System.out.println( "FAILED!" ); return false; } } return true; } try { return check( "latin-1", "ISO-8859-1" ) && check( "utf-8", "UTF-8" ); } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/pom-filtering-encoding/pom.xml0000644000175000017500000000434311137127646023274 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker pom-filtering-encoding 1.0-SNAPSHOT pom Test to check for proper handling of file encoding during POM filtering. org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml process-resources ©®ÄÖÜäöüß integration-test initialize run maven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/0000755000175000017500000000000011623526251022535 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/it/0000755000175000017500000000000011623526251023151 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/it/utf-8/0000755000175000017500000000000011623526251024114 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/it/utf-8/pom.xml0000644000175000017500000000363111056317365025440 0ustar tonytony 4.0.0 test pom-filtering-encoding-utf8 0.1-SNAPSHOT jar UTF-8 ©®ÄÖÜäöüß @latin1Chars@ ${basedir} false *.xml maven-resources-plugin 2.2 maven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/it/latin-1/0000755000175000017500000000000011623526251024416 5ustar tonytonymaven-invoker-plugin-1.5/src/it/pom-filtering-encoding/src/it/latin-1/pom.xml0000644000175000017500000000363411056317365025745 0ustar tonytony 4.0.0 test pom-filtering-encoding-latin1 0.1-SNAPSHOT jar UTF-8 ©®ÄÖÜäöüß @latin1Chars@ ${basedir} false *.xml maven-resources-plugin 2.2 maven-invoker-plugin-1.5/src/it/script-global-vars/0000755000175000017500000000000011623526250021120 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-global-vars/pom.xml0000644000175000017500000000426111137127646022446 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-global-vars 1.0-SNAPSHOT pom Test to check for existence of supported global script variables. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ */pom.xml setup verify validate integration-test initialize run maven-invoker-plugin-1.5/src/it/script-global-vars/src/0000755000175000017500000000000011623526250021707 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-global-vars/src/it/0000755000175000017500000000000011623526250022323 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-global-vars/src/it/beanshell/0000755000175000017500000000000011623526250024260 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-global-vars/src/it/beanshell/verify.bsh0000644000175000017500000000104611154730610026257 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { System.out.println( basedir ); if ( !( basedir instanceof File ) ) { System.out.println( "Global script variable not defined: basedir" ); return false; } System.out.println( localRepositoryPath ); if ( !( localRepositoryPath instanceof File ) ) { System.out.println( "Global script variable not defined: localRepositoryPath" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } maven-invoker-plugin-1.5/src/it/script-global-vars/src/it/beanshell/pom.xml0000644000175000017500000000240411056317365025602 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-global-vars/src/it/beanshell/setup.bsh0000644000175000017500000000104611154730610026113 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { System.out.println( basedir ); if ( !( basedir instanceof File ) ) { System.out.println( "Global script variable not defined: basedir" ); return false; } System.out.println( localRepositoryPath ); if ( !( localRepositoryPath instanceof File ) ) { System.out.println( "Global script variable not defined: localRepositoryPath" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } maven-invoker-plugin-1.5/src/it/script-global-vars/src/it/groovy/0000755000175000017500000000000011623526250023650 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-global-vars/src/it/groovy/verify.groovy0000644000175000017500000000074311154730610026423 0ustar tonytonyimport java.io.* import java.util.* import java.util.regex.* try { println basedir if ( !( basedir instanceof File ) ) { println "Global script variable not defined: basedir" return false } println localRepositoryPath if ( !( localRepositoryPath instanceof File ) ) { println "Global script variable not defined: localRepositoryPath" return false } } catch( Throwable t ) { t.printStackTrace() return false } maven-invoker-plugin-1.5/src/it/script-global-vars/src/it/groovy/pom.xml0000644000175000017500000000240111056317365025167 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-global-vars/src/it/groovy/setup.groovy0000644000175000017500000000074311154730610026257 0ustar tonytonyimport java.io.* import java.util.* import java.util.regex.* try { println basedir if ( !( basedir instanceof File ) ) { println "Global script variable not defined: basedir" return false } println localRepositoryPath if ( !( localRepositoryPath instanceof File ) ) { println "Global script variable not defined: localRepositoryPath" return false } } catch( Throwable t ) { t.printStackTrace() return false } maven-invoker-plugin-1.5/src/it/local-repo-isolated/0000755000175000017500000000000011623526250021244 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-isolated/verify.bsh0000644000175000017500000000152311047543322023246 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File badRepoDir = new File( basedir, "target/bad-repo" ); if ( badRepoDir.exists() ) { System.out.println( "IT used wrong local repository: " + badRepoDir ); return false; } File itRepoDir = new File( basedir, "target/it-repo" ); if ( !itRepoDir.isDirectory() ) { System.out.println( "IT local repository missing: " + itRepoDir ); return false; } File installedFile = new File( itRepoDir, "test/local-repo-isolated/0.1-SNAPSHOT/local-repo-isolated-0.1-SNAPSHOT.pom" ); if ( !installedFile.isFile() ) { System.out.println( "Installed file missing in local repo: " + installedFile ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/local-repo-isolated/pom.xml0000644000175000017500000000430611137127646022572 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker local-repo-isolated 1.0-SNAPSHOT pom Test to check for usage of an isolated local repository. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo */pom.xml src/it/settings.xml install integration-test initialize run maven-invoker-plugin-1.5/src/it/local-repo-isolated/src/0000755000175000017500000000000011623526250022033 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-isolated/src/it/0000755000175000017500000000000011623526250022447 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-isolated/src/it/settings.xml0000644000175000017500000000345411056317365025044 0ustar tonytony @project.build.directory@/bad-repo it-repo true local.central file://@localRepository@ true true local.central file://@localRepository@ true true maven-invoker-plugin-1.5/src/it/local-repo-isolated/src/it/project/0000755000175000017500000000000011623526250024115 5ustar tonytonymaven-invoker-plugin-1.5/src/it/local-repo-isolated/src/it/project/pom.xml0000644000175000017500000000241611056317365025442 0ustar tonytony 4.0.0 test local-repo-isolated 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/staging-reactor/0000755000175000017500000000000011623526251020477 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/verify.bsh0000644000175000017500000000333711242337166022511 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { File itRepoDir = new File( basedir, "mod1/target/it-repo" ); System.out.println( "Checking for existence of: " + itRepoDir ); if ( !itRepoDir.isDirectory() ) { System.out.println( "FAILED!" ); return false; } // NOTE: Checking the metadata is included to guard against regression of MINVOKER-43 String[] files = { "test/mod1/maven-metadata-local.xml", "test/mod1/1.0-SNAPSHOT/maven-metadata-local.xml", "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.pom", "test/mod1/1.0-SNAPSHOT/mod1-1.0-SNAPSHOT.jar", "test/mod1-parent/maven-metadata-local.xml", "test/mod1-parent/1.0-SNAPSHOT/maven-metadata-local.xml", "test/mod1-parent/1.0-SNAPSHOT/mod1-parent-1.0-SNAPSHOT.pom", "test/mod2/maven-metadata-local.xml", "test/mod2/1.0-SNAPSHOT/maven-metadata-local.xml", "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.pom", "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT.jar", "test/mod2/1.0-SNAPSHOT/mod2-1.0-SNAPSHOT-sources.jar", "test/mod2-parent/maven-metadata-local.xml", "test/mod2-parent/1.0-SNAPSHOT/maven-metadata-local.xml", "test/mod2-parent/1.0-SNAPSHOT/mod2-parent-1.0-SNAPSHOT.pom", }; for ( String file : files ) { File stagedFile = new File( itRepoDir, file ); System.out.println( "Checking for existence of: " + stagedFile ); if ( !stagedFile.isFile() ) { System.out.println( "FAILED!" ); return false; } } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/staging-reactor/invoker.properties0000644000175000017500000000003511137127646024275 0ustar tonytonyinvoker.goals = clean verify maven-invoker-plugin-1.5/src/it/staging-reactor/pom.xml0000644000175000017500000000331711056525057022023 0ustar tonytony 4.0.0 test mod2-parent 1.0-SNAPSHOT pom Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. mod1 mod2 UTF-8 org.apache.maven.plugins maven-site-plugin 2.0-beta-7 maven-invoker-plugin-1.5/src/it/staging-reactor/mod1-parent/0000755000175000017500000000000011623526251022626 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod1-parent/pom.xml0000644000175000017500000000320111056525057024142 0ustar tonytony 4.0.0 test mod1-parent 1.0-SNAPSHOT pom Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. UTF-8 org.apache.maven.plugins maven-site-plugin 2.0-beta-7 maven-invoker-plugin-1.5/src/it/staging-reactor/mod2/0000755000175000017500000000000011623526251021340 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod2/pom.xml0000644000175000017500000000361211056317365022663 0ustar tonytony 4.0.0 test mod2-parent 1.0-SNAPSHOT test mod2 1.0-SNAPSHOT jar Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. UTF-8 maven-source-plugin 2.0.4 attach-resources jar maven-invoker-plugin-1.5/src/it/staging-reactor/mod2/src/0000755000175000017500000000000011623526251022127 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod2/src/main/0000755000175000017500000000000011623526251023053 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod2/src/main/resources/0000755000175000017500000000000011623526251025065 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod2/src/main/resources/main.properties0000644000175000017500000000000011050572246030114 0ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod1/0000755000175000017500000000000011623526251021337 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/mod1/pom.xml0000644000175000017500000000457411056317365022672 0ustar tonytony 4.0.0 test mod1-parent 1.0-SNAPSHOT ../mod1-parent test mod1 1.0-SNAPSHOT jar Test to check for proper staging during a multi module build, i.e. artifacts from the reactor need to be considered. UTF-8 test mod2 1.0-SNAPSHOT org.apache.maven.plugins maven-invoker-plugin ${invoker.version} ${project.build.directory}/it-repo integration-test install maven-invoker-plugin-1.5/src/it/staging-reactor/src/0000755000175000017500000000000011623526251021266 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/src/site/0000755000175000017500000000000011623526251022232 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-reactor/src/site/site.xml0000644000175000017500000000151511056525057023725 0ustar tonytony maven-invoker-plugin-1.5/src/it/staging-dependencies/0000755000175000017500000000000011623526250021465 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/verify.bsh0000644000175000017500000000606211252777067023507 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; import org.codehaus.plexus.util.xml.*; try { File itRepoDir = new File( basedir, "target/it-repo" ); System.out.println( "Checking for existence of: " + itRepoDir ); if ( !itRepoDir.isDirectory() ) { System.out.println( "FAILED!" ); return false; } String[] files = { "junit/junit/3.8.2/junit-3.8.2.pom", "junit/junit/3.8.2/junit-3.8.2.jar", "junit/junit/maven-metadata-local.xml", "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.pom", "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-SNAPSHOT.jar", "org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata-local.xml", "org/apache/maven/its/minvoker-70/maven-metadata-local.xml", "org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-SNAPSHOT.pom", "org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata-local.xml", "org/apache/maven/its/parent-b/maven-metadata-local.xml", "org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-SNAPSHOT.pom", "org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata-local.xml", "org/apache/maven/its/parent-a/maven-metadata-local.xml", "org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-SNAPSHOT.pom", "org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata-local.xml", "org/apache/maven/its/pom/maven-metadata-local.xml", "org/apache/maven/its/dep/1.0/dep-1.0.pom", "org/apache/maven/its/dep/1.0/dep-1.0-tests.jar", "org/apache/maven/its/dep/2.0/dep-2.0.pom", "org/apache/maven/its/dep/2.0/dep-2.0.jar", "org/apache/maven/its/dep/maven-metadata-local.xml", }; for ( String file : files ) { File stagedFile = new File( itRepoDir, file ); System.out.println( "Checking for existence of: " + stagedFile ); if ( !stagedFile.isFile() ) { throw new IllegalStateException( "Missing: " + stagedFile ); } } Reader reader = ReaderFactory.newXmlReader( new File( itRepoDir, "org/apache/maven/its/dep/maven-metadata-local.xml" ) ); Xpp3Dom dom = Xpp3DomBuilder.build( reader ); IOUtil.close( reader ); if ( dom.getChild( "versioning" ).getChild( "versions" ).getChildCount() != 2 ) { throw new IllegalStateException( "Invalid version number count in metadata" ); } List versions = new ArrayList(); versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 0 ).getValue() ); versions.add( dom.getChild( "versioning" ).getChild( "versions" ).getChild( 1 ).getValue() ); Collections.sort( versions ); if ( !versions.equals( Arrays.asList( new String[] { "1.0", "2.0" } ) ) ) { throw new IllegalStateException( "Invalid version numbers in metadata: " + versions ); } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/0000755000175000017500000000000011623526250022432 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/0000755000175000017500000000000011623526250023221 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/0000755000175000017500000000000011623526250024442 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/0000755000175000017500000000000011623526250025550 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/0000755000175000017500000000000011623526250026347 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0000755000175000017500000000000011623526250030057 5ustar tonytony././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT0000755000175000017500000000000011623526250031533 5ustar tonytony././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/parent-b-0.1-20081020.164906-1.pommaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT0000644000175000017500000000111011150621463031523 0ustar tonytony 4.0.0 org.apache.maven.its parent-a 0.1-SNAPSHOT org.apache.maven.its parent-b pom 0.1-SNAPSHOT ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-b/0.1-SNAPSHOT0000644000175000017500000000055211150621463031534 0ustar tonytony org.apache.maven.its parent-b 0.1-SNAPSHOT 20081020.164906 1 20081020164906 maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/0000755000175000017500000000000011623526250030425 5ustar tonytony././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPS0000755000175000017500000000000011623526250031526 5ustar tonytony././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.pommaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPS0000644000175000017500000000111311150621463031521 0ustar tonytony 4.0.0 org.apache.maven.its parent-b 0.1-SNAPSHOT org.apache.maven.its minvoker-70 jar 1.0-SNAPSHOT ././@LongLink0000000000000000000000000000021600000000000011564 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/minvoker-70-1.0-20081020.164906-1.jarmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPS0000644000175000017500000000053111077201155031524 0ustar tonytonyPKE¹T9 META-INF/þÊPKPKE¹T9META-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àår.JM,IMÑuª ˜éĘ+h—æ)øf&åW—¤æ+xæ%ëiòrñrPK”[ØGGPKE¹T9 META-INF/þÊPKE¹T9”[ØGG=META-INF/MANIFEST.MFPK}Æ././@LongLink0000000000000000000000000000017300000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPSHOT/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/1.0-SNAPS0000644000175000017500000000055511077201155031532 0ustar tonytony org.apache.maven.its minvoker-70 1.0-SNAPSHOT 20081020.164906 1 20081020164906 ././@LongLink0000000000000000000000000000015600000000000011567 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/minvoker-70/maven-met0000644000175000017500000000050311077201155032234 0ustar tonytony org.apache.maven.its minvoker-70 1.0-SNAPSHOT 1.0-SNAPSHOT 20081020164906 maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/0000755000175000017500000000000011623526250027117 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/0000755000175000017500000000000011623526250027415 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0.pom0000644000175000017500000000065011252777067031213 0ustar tonytony 4.0.0 org.apache.maven.its dep jar 1.0 ././@LongLink0000000000000000000000000000015100000000000011562 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0-tests.jarmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/1.0/dep-1.0-tests0000644000175000017500000000053111252777067031557 0ustar tonytonyPKE¹T9 META-INF/þÊPKPKE¹T9META-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àår.JM,IMÑuª ˜éĘ+h—æ)øf&åW—¤æ+xæ%ëiòrñrPK”[ØGGPKE¹T9 META-INF/þÊPKE¹T9”[ØGG=META-INF/MANIFEST.MFPK}Æmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/0000755000175000017500000000000011623526250027416 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.jar0000644000175000017500000000053111252777067031174 0ustar tonytonyPKE¹T9 META-INF/þÊPKPKE¹T9META-INF/MANIFEST.MFóMÌËLK-.Ñ K-*ÎÌϳR0Ô3àår.JM,IMÑuª ˜éĘ+h—æ)øf&åW—¤æ+xæ%ëiòrñrPK”[ØGGPKE¹T9 META-INF/þÊPKE¹T9”[ØGG=META-INF/MANIFEST.MFPK}Æmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/2.0/dep-2.0.pom0000644000175000017500000000065011252777067031215 0ustar tonytony 4.0.0 org.apache.maven.its dep jar 2.0 ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/dep/maven-metadata.xm0000644000175000017500000000054111252777067032365 0ustar tonytony org.apache.maven.its dep 2.0 2.0 1.0 2.0 20081020164906 maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0000755000175000017500000000000011623526250030056 5ustar tonytony././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT0000755000175000017500000000000011623526250031532 5ustar tonytony././@LongLink0000000000000000000000000000021000000000000011556 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/parent-a-0.1-20081020.164906-1.pommaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT0000644000175000017500000000066611150621463031541 0ustar tonytony 4.0.0 org.apache.maven.its parent-a pom 0.1-SNAPSHOT ././@LongLink0000000000000000000000000000017000000000000011563 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/parent-a/0.1-SNAPSHOT0000644000175000017500000000055211150621463031533 0ustar tonytony org.apache.maven.its parent-a 0.1-SNAPSHOT 20081020.164906 1 20081020164906 maven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0000755000175000017500000000000011623526250027142 5ustar tonytonymaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/0000755000175000017500000000000011623526250030677 5ustar tonytony././@LongLink0000000000000000000000000000017600000000000011571 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0.3-20081020.164906-1.pommaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/pom-0000644000175000017500000000066111150621463031472 0ustar tonytony 4.0.0 org.apache.maven.its pom pom 0.3-SNAPSHOT ././@LongLink0000000000000000000000000000016300000000000011565 Lustar rootrootmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/maven-metadata.xmlmaven-invoker-plugin-1.5/src/it/staging-dependencies/repo/org/apache/maven/its/pom/0.3-SNAPSHOT/mave0000644000175000017500000000054511150621463031553 0ustar tonytony org.apache.maven.its pom 0.3-SNAPSHOT 20081020.164906 1 20081020164906 maven-invoker-plugin-1.5/src/it/staging-dependencies/invoker.properties0000644000175000017500000000003511137127646025264 0ustar tonytonyinvoker.goals = clean verify maven-invoker-plugin-1.5/src/it/staging-dependencies/pom.xml0000644000175000017500000000641011252777067023017 0ustar tonytony 4.0.0 test staging-dependencies 1.0-SNAPSHOT Test to check for staging of (runtime) dependencies directly from local repository (MINVOKER-64, MINVOKER-70). junit junit 3.8.2 org.apache.maven.its minvoker-70 1.0-SNAPSHOT org.apache.maven.its pom 0.3-SNAPSHOT pom org.apache.maven.its dep 1.0 tests org.apache.maven.its dep 2.0 maven-invoker-plugin-it file:///${basedir}/repo ignore ignore org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it-repo integration-test install maven-invoker-plugin-1.5/src/it/invocation-project/0000755000175000017500000000000011623526251021223 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/verify.bsh0000644000175000017500000000134511134630474023230 0ustar tonytonyimport java.io.*; String[] unexpectedPaths = { "sub-1/target", "sub-3/target", }; for ( String path : unexpectedPaths ) { File file = new File( new File( basedir, "target/it/project" ), path); System.out.println( "Creating for absence of: " + file ); if ( file.exists() ) { throw new IOException( "Unexpected path found: " + file ); } } String[] expectedPaths = { "target", "sub-2/target", }; for ( String path : expectedPaths ) { File file = new File( new File( basedir, "target/it/project" ), path); System.out.println( "Creating for existence of: " + file ); if ( !file.exists() ) { throw new IOException( "Expected path not found: " + file ); } } return true; maven-invoker-plugin-1.5/src/it/invocation-project/pom.xml0000644000175000017500000000472111137127646022551 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker invocation-project 1.0-SNAPSHOT pom Test to check that invocations can use a different POM than the one that was selected via the pomInclude parameter. This allows fine-grained control over the build of a multi-module project where the modules are (intentionally) not collectively build by the reactor. UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ ${project.build.directory}/it */pom.xml src/it/settings.xml setup.bsh clean integration-test initialize run maven-invoker-plugin-1.5/src/it/invocation-project/src/0000755000175000017500000000000011623526251022012 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/0000755000175000017500000000000011623526251022426 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/settings.xml0000644000175000017500000000366111134630474025016 0ustar tonytony it-repo true local.central file://@invoker.repo.local@ true true local.central file://@invoker.repo.local@ true true maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/0000755000175000017500000000000011623526251024074 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/invoker.properties0000644000175000017500000000014411134633616027667 0ustar tonytony# path to POM invoker.project.1 = sub-1/pom.xml # path to base directory invoker.project.2 = sub-3 maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-1/0000755000175000017500000000000011623526251025023 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-1/pom.xml0000644000175000017500000000223211134630474026337 0ustar tonytony 4.0.0 test sub-1 0.1-SNAPSHOT jar maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/pom.xml0000644000175000017500000000241211134630474025410 0ustar tonytony 4.0.0 test aggregator 0.1-SNAPSHOT pom sub-1 sub-2 sub-3 maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-2/0000755000175000017500000000000011623526251025024 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-2/pom.xml0000644000175000017500000000223211134630474026340 0ustar tonytony 4.0.0 test sub-2 0.1-SNAPSHOT jar maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/setup.bsh0000644000175000017500000000054111154730610025725 0ustar tonytonyimport java.io.*; String[] paths = { "target", "sub-1/target", "sub-2/target", "sub-3/target", }; for ( String path : paths ) { File dir = new File( basedir, path); System.out.println( "Creating directory: " + dir ); if ( !dir.mkdirs() ) { throw new IOException( "Failed to create directory: " + dir ); } } maven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-3/0000755000175000017500000000000011623526251025025 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-project/src/it/project/sub-3/pom.xml0000644000175000017500000000223211134630474026341 0ustar tonytony 4.0.0 test sub-3 0.1-SNAPSHOT jar maven-invoker-plugin-1.5/src/it/invocation-multiple/0000755000175000017500000000000011623526251021410 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/verify.bsh0000644000175000017500000000234511054337603023415 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { File test0File = new File( basedir, "target/it/project/target/test0.txt" ); System.out.println( "Checking for existence of first test file: " + test0File ); if ( !test0File.exists() ) { System.out.println( "FAILED!" ); return false; } String test0 = FileUtils.fileRead( test0File, "UTF-8" ).trim(); System.out.println( "Checking contents of first test file: " + test0 ); if ( !"ISO-8859-1".equals( test0 ) ) { System.out.println( "FAILED!" ); return false; } File test1File = new File( basedir, "target/it/project/target/test1.txt" ); System.out.println( "Checking for existence of second test file: " + test1File ); if ( !test1File.exists() ) { System.out.println( "FAILED!" ); return false; } String test1 = FileUtils.fileRead( test1File, "UTF-8" ).trim(); System.out.println( "Checking contents of second test file: " + test1 ); if ( !"UTF-8".equals( test1 ) ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/invocation-multiple/pom.xml0000644000175000017500000000455111137127646022737 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker invocation-multiple 1.0-SNAPSHOT pom Test to check for proper support of multiple Maven invocations per project. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml src/it/settings.xml validate ${invoker.repo.local} integration-test initialize run maven-invoker-plugin-1.5/src/it/invocation-multiple/src/0000755000175000017500000000000011623526251022177 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/0000755000175000017500000000000011623526251022613 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/settings.xml0000644000175000017500000000366111056317365025207 0ustar tonytony it-repo true local.central file://@invoker.repo.local@ true true local.central file://@invoker.repo.local@ true true maven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/0000755000175000017500000000000011623526251024261 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/invoker.properties0000644000175000017500000000156411150314167030056 0ustar tonytony####################################### # Default build ####################################### invoker.goals = install invoker.profiles = plugin,profile0 invoker.systemPropertiesFile = system1.properties ####################################### # First build ####################################### # goals should fall back to invoker.goals invoker.profiles.1 = ####################################### # Second build ####################################### invoker.goals.2 = test:test-maven-plugin:0.1-SNAPSHOT:test invoker.profiles.2 = plugin,profile1 # system properties file should fall back to invoker.systemPropertiesFile ####################################### # Third build ####################################### invoker.goals.3 = test:test-maven-plugin:0.1-SNAPSHOT:test # profiles should fall back to invoker.profiles invoker.systemPropertiesFile.3 = system2.properties maven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/pom.xml0000644000175000017500000000614711056317365025612 0ustar tonytony 4.0.0 test test-maven-plugin 0.1-SNAPSHOT maven-plugin 2.0 UTF-8 org.apache.maven maven-plugin-api 2.0 maven-compiler-plugin 2.0.2 1.4 1.4 maven-install-plugin 2.2 maven-jar-plugin 2.2 maven-plugin-plugin 2.4.2 maven-resources-plugin 2.2 maven-surefire-plugin 2.4.3 plugin ${project.groupId} ${project.artifactId} ${project.version} ${project.build.directory}/${testProperty}.txt profile0 test0 profile1 test1 maven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/system2.properties0000644000175000017500000000004011150314167027773 0ustar tonytonymaven.invoker.test = ISO-8859-1 maven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/system1.properties0000644000175000017500000000003311150314167027774 0ustar tonytonymaven.invoker.test = UTF-8 maven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/src/0000755000175000017500000000000011623526251025050 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/src/main/0000755000175000017500000000000011623526251025774 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/src/main/java/0000755000175000017500000000000011623526251026715 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/src/main/java/org/0000755000175000017500000000000011623526251027504 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-multiple/src/it/project/src/main/java/org/TestMojo.java0000644000175000017500000000214011147553471032115 0ustar tonytonypackage org; import java.io.*; import java.util.*; import org.apache.maven.plugin.*; /** * @goal test */ public class TestMojo extends AbstractMojo { /** * @parameter default-value="${project.build.directory}/test.txt" */ private File outputFile; /** * @see org.apache.maven.plugin.AbstractMojo#execute() */ public void execute() throws MojoExecutionException, MojoFailureException { outputFile.getParentFile().mkdirs(); Writer writer = null; try { writer = new OutputStreamWriter( new FileOutputStream( outputFile ), "UTF-8" ); writer.write( System.getProperty( "maven.invoker.test", "null" ) ); } catch (IOException e) { throw new MojoExecutionException( "Failed", e ); } finally { if ( writer != null ) { try { writer.close(); } catch (IOException e) { // ignore } } } } } maven-invoker-plugin-1.5/src/it/fail-postbuild/0000755000175000017500000000000011623526250020323 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-postbuild/verify.bsh0000644000175000017500000000077211054073172022331 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; try { // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else File touchFile = new File( basedir, "target/it/project/touch.txt" ); System.out.println( "Checking for existence of touch file: " + touchFile ); if ( !touchFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/fail-postbuild/invoker.properties0000644000175000017500000000003611137127646024123 0ustar tonytonyinvoker.buildResult = failure maven-invoker-plugin-1.5/src/it/fail-postbuild/pom.xml0000644000175000017500000000425011137127646021647 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-postbuild 1.0-SNAPSHOT pom Test to check that a failure of the post-build hook fails the parent build, too. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/fail-postbuild/src/0000755000175000017500000000000011623526250021112 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-postbuild/src/it/0000755000175000017500000000000011623526250021526 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-postbuild/src/it/project/0000755000175000017500000000000011623526250023174 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-postbuild/src/it/project/prebuild.bsh0000644000175000017500000000023711154730610025476 0ustar tonytonyimport java.io.*; // marker for parent build that this sub build was indeed run File touchFile = new File( basedir, "touch.txt" ); touchFile.createNewFile(); maven-invoker-plugin-1.5/src/it/fail-postbuild/src/it/project/pom.xml0000644000175000017500000000241011056317365024513 0ustar tonytony 4.0.0 test fail-prebuild 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/fail-postbuild/src/it/project/postbuild.bsh0000644000175000017500000000001611054073172025672 0ustar tonytonyreturn false; maven-invoker-plugin-1.5/src/it/invocation-spaces/0000755000175000017500000000000011623526250021032 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/verify.bsh0000644000175000017500000000260311056330714023033 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { File testFile = new File( basedir, "target/it projects/project/target/classes/test.txt" ); System.out.println( "Checking for existence of test file: " + testFile ); if ( !testFile.exists() ) { System.out.println( "FAILED!" ); return false; } String[] values = { "value with spaces from settings", "value with spaces from cli", }; BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( testFile ), "UTF-8" ) ); try { for ( String value : values ) { String line = reader.readLine(); System.out.println( "Checking for occurrence of: " + value ); if ( !value.equals( line ) ) { System.out.println( "FAILED!" ); return false; } } } finally { reader.close(); } File installedFile = new File( basedir, "target/it repo/test/spacy-pom/0.1-SNAPSHOT/spacy-pom-0.1-SNAPSHOT.jar" ); System.out.println( "Checking for existence of installed file: " + installedFile ); if ( !installedFile.exists() ) { System.out.println( "FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/invocation-spaces/pom.xml0000644000175000017500000000525711137127646022366 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker invocation-spaces 1.0-SNAPSHOT pom Test to check for proper handling of Maven invocations that involve spaces on the command line. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true src/it projects ${project.build.directory}/it projects */*pom.xml ${project.build.directory}/it repo src/it projects/settings.xml install value with spaces from cli ${invoker.repo.local} integration-test initialize run maven-invoker-plugin-1.5/src/it/invocation-spaces/src/0000755000175000017500000000000011623526250021621 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/0000755000175000017500000000000011623526250024047 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/settings.xml0000644000175000017500000000405511056330714026433 0ustar tonytony it-repo true value with spaces from settings local.central file://@invoker.repo.local@ true true local.central file://@invoker.repo.local@ true true maven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/0000755000175000017500000000000011623526250025515 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/spacy pom.xml0000644000175000017500000000453111056330714030133 0ustar tonytony 4.0.0 test spacy-pom 0.1-SNAPSHOT jar UTF-8 src/main/resources true org.apache.maven.plugins maven-compiler-plugin 2.0.2 org.apache.maven.plugins maven-install-plugin 2.2 maven-jar-plugin 2.2 org.apache.maven.plugins maven-resources-plugin 2.2 ${project.build.sourceEncoding} org.apache.maven.plugins maven-surefire-plugin 2.4.3 maven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/src/0000755000175000017500000000000011623526250026304 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/src/main/0000755000175000017500000000000011623526250027230 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/src/main/resources/0000755000175000017500000000000011623526250031242 5ustar tonytony././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.txtmaven-invoker-plugin-1.5/src/it/invocation-spaces/src/it projects/project/src/main/resources/test.tx0000644000175000017500000000006311056330714032573 0ustar tonytony${propertyFromSettings} ${propertyFromCommandLine} maven-invoker-plugin-1.5/src/it/invoker-report/0000755000175000017500000000000011623526250020373 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/verify.bsh0000644000175000017500000000044311145375757022413 0ustar tonytonyimport java.io.*; import java.util.*; File reportFile = new File( basedir, "target/site/invoker-report.html"); System.out.println( "Checking for existence of report file: " + reportFile ); if ( !reportFile.exists() ) { System.out.println( "FAILED!" ); return false; } return true;maven-invoker-plugin-1.5/src/it/invoker-report/invoker.properties0000644000175000017500000000005411150631014024153 0ustar tonytonyinvoker.goals = clean integration-test site maven-invoker-plugin-1.5/src/it/invoker-report/pom.xml0000644000175000017500000000513711256227725021725 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker invoker-report 1.0-SNAPSHOT pom Test UTF-8 org.apache.maven.plugins maven-invoker-plugin @project.version@ */pom.xml setup verify true validate integration-test initialize run org.apache.maven.plugins maven-site-plugin @sitePluginVersion@ true org.apache.maven.plugins maven-invoker-plugin @project.version@ maven-invoker-plugin-1.5/src/it/invoker-report/src/0000755000175000017500000000000011623526250021162 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/0000755000175000017500000000000011623526250021576 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-build/0000755000175000017500000000000011623526250024322 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-build/pom.xml0000644000175000017500000000263311146057335025646 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 foo maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-post/0000755000175000017500000000000011623526250024210 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-post/verify.bsh0000644000175000017500000000012111146057335026207 0ustar tonytonythrow new IllegalStateException( "The post-build script failed as expected." ); maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-post/invoker.properties0000644000175000017500000000006011146057335030002 0ustar tonytonyinvoker.description = A build job without name. maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-post/pom.xml0000644000175000017500000000237711146057335025541 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/invoker-report/src/it/success/0000755000175000017500000000000011623526250023246 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/success/invoker.properties0000644000175000017500000000011611146057335027042 0ustar tonytonyinvoker.name = Success invoker.description = A build job that should succeed. maven-invoker-plugin-1.5/src/it/invoker-report/src/it/success/pom.xml0000644000175000017500000000237711146057335024577 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-pre/0000755000175000017500000000000011623526250024011 5ustar tonytonymaven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-pre/invoker.properties0000644000175000017500000000003611146057335027606 0ustar tonytonyinvoker.name = No Description maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-pre/pom.xml0000644000175000017500000000237711146057335025342 0ustar tonytony 4.0.0 test test 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/invoker-report/src/it/failure-pre/setup.bsh0000644000175000017500000000012011146057335025643 0ustar tonytonythrow new IllegalStateException( "The pre-build script failed as expected." ); maven-invoker-plugin-1.5/src/it/script-class-loading/0000755000175000017500000000000011623526250021427 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/invoker.properties0000644000175000017500000000004311137127646025225 0ustar tonytonyinvoker.goals = clean test-compile maven-invoker-plugin-1.5/src/it/script-class-loading/pom.xml0000644000175000017500000000517611137127646022763 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker script-class-loading 1.0-SNAPSHOT jar Test to check for proper class loading in hook scripts (i.e. project test class path before plugin class path) UTF-8 org.codehaus.plexus plexus-utils 1.1 test org.apache.maven.plugins maven-invoker-plugin @pom.version@ true */pom.xml prebuild postbuild validate true integration-test test-compile run maven-invoker-plugin-1.5/src/it/script-class-loading/src/0000755000175000017500000000000011623526250022216 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/test/0000755000175000017500000000000011623526250023175 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/test/java/0000755000175000017500000000000011623526250024116 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/test/java/org/0000755000175000017500000000000011623526250024705 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/test/java/org/MyUtils.java0000644000175000017500000000016511050633614027155 0ustar tonytonypackage org; public class MyUtils { public static String getNothing() { return "nothing"; } } maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/0000755000175000017500000000000011623526250022632 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/it/beanshell/0000755000175000017500000000000011623526250024567 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/it/beanshell/prebuild.bsh0000644000175000017500000000133611154730610027072 0ustar tonytonyimport java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { System.out.println( "Invoking class from project's test class path" ); System.out.println( org.MyUtils.getNothing() ); System.out.println( "Trying to access method which is unavaible in old plexus-utils" ); try { System.out.println( FileUtils.class.getMethod( "copyFileIfModified", new Class[] { File.class, File.class } ) ); System.out.println( "FAILED!" ); return false; } catch( NoSuchMethodException e ) { // expected e.printStackTrace(); } } catch( Throwable t ) { t.printStackTrace(); return false; } maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/beanshell/pom.xml0000644000175000017500000000240411056317365026111 0ustar tonytony 4.0.0 test beanshell 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/beanshell/postbuild.bsh0000644000175000017500000000133611154730610027271 0ustar tonytonyimport java.io.*; import java.lang.reflect.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { System.out.println( "Invoking class from project's test class path" ); System.out.println( org.MyUtils.getNothing() ); System.out.println( "Trying to access method which is unavaible in old plexus-utils" ); try { System.out.println( FileUtils.class.getMethod( "copyFileIfModified", new Class[] { File.class, File.class } ) ); System.out.println( "FAILED!" ); return false; } catch( NoSuchMethodException e ) { // expected e.printStackTrace(); } } catch( Throwable t ) { t.printStackTrace(); return false; } maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/groovy/0000755000175000017500000000000011623526250024157 5ustar tonytonymaven-invoker-plugin-1.5/src/it/script-class-loading/src/it/groovy/prebuild.groovy0000644000175000017500000000123511154730610027231 0ustar tonytonyimport java.io.* import java.lang.reflect.* import java.util.* import java.util.regex.* import org.codehaus.plexus.util.* try { println "Invoking class from project's test class path" println org.MyUtils.getNothing() println "Trying to access method which is unavaible in old plexus-utils" try { Class[] types = [ File.class, File.class ]; println FileUtils.class.getMethod( "copyFileIfModified", types ) println "FAILED!" return false } catch( NoSuchMethodException e ) { // expected e.printStackTrace() } } catch( Throwable t ) { t.printStackTrace() return false } maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/groovy/pom.xml0000644000175000017500000000240111056317365025476 0ustar tonytony 4.0.0 test groovy 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/script-class-loading/src/it/groovy/postbuild.groovy0000644000175000017500000000123511154730610027430 0ustar tonytonyimport java.io.* import java.lang.reflect.* import java.util.* import java.util.regex.* import org.codehaus.plexus.util.* try { println "Invoking class from project's test class path" println org.MyUtils.getNothing() println "Trying to access method which is unavaible in old plexus-utils" try { Class[] types = [ File.class, File.class ]; println FileUtils.class.getMethod( "copyFileIfModified", types ) println "FAILED!" return false } catch( NoSuchMethodException e ) { // expected e.printStackTrace() } } catch( Throwable t ) { t.printStackTrace() return false } maven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/0000755000175000017500000000000011623526251022055 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/pom.xml0000644000175000017500000000441211242014434023363 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker fail-ignore 1.0-SNAPSHOT pom Test to check that a failure in the forked Maven builds is ignored. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ true ${project.build.directory}/it */pom.xml invalid-phase-to-fail-build true integration-test initialize integration-test verify maven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/src/0000755000175000017500000000000011623526251022644 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/src/it/0000755000175000017500000000000011623526251023260 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/src/it/project/0000755000175000017500000000000011623526251024726 5ustar tonytonymaven-invoker-plugin-1.5/src/it/fail-ignore-with-verify/src/it/project/pom.xml0000644000175000017500000000240611057057065026250 0ustar tonytony 4.0.0 test fail-ignore 0.1-SNAPSHOT jar UTF-8 maven-invoker-plugin-1.5/src/it/project-setup/0000755000175000017500000000000011623526250020211 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/verify.bsh0000644000175000017500000000315111140143601022200 0ustar tonytonyimport java.io.*; import java.util.*; import java.util.regex.*; import org.codehaus.plexus.util.*; try { File logFile = new File( basedir, "build.log" ); System.out.println( "Checking for existence of build log: " + logFile ); if ( !logFile.exists() ) { System.out.println( "FAILED!" ); return false; } String log = FileUtils.fileRead( logFile ); System.out.println( "Checking for first build" ); int index = log.indexOf( "Building: project" ); if ( !log.substring( index, index + 18 ).equals( "Building: project3" ) ) { System.out.println( "FAILED!\n" + log.substring( index, index + 18 ) ); return false; } System.out.println( "Checking for duplicate build" ); index = log.indexOf( "Building: project3", index + 1 ); if ( index >= 0 ) { System.out.println( "FAILED!" ); return false; } File reportFile = new File( basedir, "target/invoker-reports/BUILD-project1.xml" ); if ( !reportFile.exists() ) { System.out.println( "reportFile not exists FAILED!" ); return false; } String report = FileUtils.fileRead( reportFile, "UTF-8" ); index = report.indexOf("name=\"Foo\""); if ( index < 0 ) { System.out.println( "name missing in the report FAILED!" ); return false; } index = report.indexOf("description=\"good foo\""); if ( index < 0 ) { System.out.println( "description missing in the report FAILED!" ); return false; } } catch( Throwable t ) { t.printStackTrace(); return false; } return true; maven-invoker-plugin-1.5/src/it/project-setup/pom.xml0000644000175000017500000000434211137127646021537 0ustar tonytony 4.0.0 org.apache.maven.plugins.invoker project-setup 1.0-SNAPSHOT pom Test to check that setup projects are run ahead of the other ones. UTF-8 org.apache.maven.plugins maven-invoker-plugin @pom.version@ ${project.build.directory}/it project3 */pom.xml validate integration-test initialize run maven-invoker-plugin-1.5/src/it/project-setup/src/0000755000175000017500000000000011623526250021000 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/0000755000175000017500000000000011623526250021414 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project2/0000755000175000017500000000000011623526250023144 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project2/pom.xml0000644000175000017500000000240311056317365024465 0ustar tonytony 4.0.0 test project2 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-setup/src/it/project4/0000755000175000017500000000000011623526250023146 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project4/pom.xml0000644000175000017500000000240311056317365024467 0ustar tonytony 4.0.0 test project4 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-setup/src/it/project1/0000755000175000017500000000000011623526250023143 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project1/invoker.properties0000644000175000017500000000006111137724247026741 0ustar tonytonyinvoker.name = Foo invoker.description = good foomaven-invoker-plugin-1.5/src/it/project-setup/src/it/project1/pom.xml0000644000175000017500000000240311056317365024464 0ustar tonytony 4.0.0 test project1 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-setup/src/it/project5/0000755000175000017500000000000011623526250023147 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project5/pom.xml0000644000175000017500000000240311056317365024470 0ustar tonytony 4.0.0 test project5 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/it/project-setup/src/it/project3/0000755000175000017500000000000011623526250023145 5ustar tonytonymaven-invoker-plugin-1.5/src/it/project-setup/src/it/project3/pom.xml0000644000175000017500000000240311056317365024466 0ustar tonytony 4.0.0 test project3 0.1-SNAPSHOT pom UTF-8 maven-invoker-plugin-1.5/src/site/0000755000175000017500000000000011623526250015735 5ustar tonytonymaven-invoker-plugin-1.5/src/site/site.xml0000644000175000017500000000445111267406352017433 0ustar tonytony maven-invoker-plugin-1.5/src/site/apt/0000755000175000017500000000000011623526250016521 5ustar tonytonymaven-invoker-plugin-1.5/src/site/apt/usage.apt.vm0000644000175000017500000001463511267416004020764 0ustar tonytony ------ Usage ------ Jason van Zyl ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Usage This page provides general usage information along with a basic example. The plugin is commonly used to run and verify integration tests for a project, say a Maven plugin. This is done using the <<<{{{run-mojo.html} invoker:run }}>>> goal. And as a preparation for the integration tests, one usually wants to stage the artifacts under tests into a testing repository. For this job, the <<<{{{install-mojo.html} invoker:install }}>>> goal can be used. * Basic Example The following example demonstrates a basic plugin configuration for running integration tests. Let's assume the following directory structure of your project: ------------------- ./ +- pom.xml +- src/ +- it/ +- settings.xml +- first-it/ | +- pom.xml | +- src/ +- second-it/ +- pom.xml +- invoker.properties +- test.properties +- verify.bsh +- src/ ------------------- In this example, the directory <<>> is the location where all the IT projects reside. You simply put each integration test into a distinct sub directory, like shown by <<>> and <<>>. The plugin configuration for this example would look like this: ------------------- ... maven-invoker-plugin ${project.version} src/it \${project.build.directory}/it */pom.xml src/it/settings.xml \${project.build.directory}/local-repo verify.bsh integration-test install run ... ------------------- Now, to get things going, just tell Maven to execute the lifecycle phase <<>>: ------------------- mvn integration-test ------------------- First, the <<>> goal will be executed during the phase <<>> and will copy the main artifact of the project along with any attached artifacts over to <<>>. Furthermore, any locally reachable parent POMs of the project will be copied to the staging repository. Last but not least, if you are running a reactor build, all project dependencies that reside in the reactor will be staged, too. Next up, the <<>> goal will execute during the phase <<>> and will use the configured include/exclude patterns to search the directory <<>> for IT POMs. Every directory where an IT POM is found will be copied over to <<>>. Additionally, the IT POMs will be filtered, i.e. expressions like <<<@project.version@>>> will be replaced with the corresponding values from the project's POM. This is especially handy to make sure your IT POMs always reference the currently built version of the project artifact. You can also define other properties via the plugin configuration that you wish to use for filtering. Once the IT POMs have been filtered, a Maven build will be started on them. By default, the Invoker Plugin will execute the phase <<>> on the IT POMs but that can be changed globally in the plugin configuration or for an individual integration test by using the <<<{{{./examples/invoker-properties.html}invoker.properties}}>>> as done in the example for <<>>. Likewise, system properties can be passed to the IT builds via the file <<>>. And the file <<>> can be used to specify custom user settings for the tests. Among others, this allows you to make the integration tests use your local repository as a remote repository, avoiding time-consuming downloads from <<>> in order to fill up the initially empty staging repository. Please see the example {{{examples/fast-use.html}Fast Invoker Plugin Configuration}} for more details on this technique. The output of the IT builds is written to a log file named <<>> (e.g. <<>>) and allows diagnostics in case an integration test fails. When an integration test has finished, the plugin will invoke an optional post build hook script. In the example, this is the case for <<>> where <<>> will be run. The purpose of this script is usally to check that the build of the integration test did not only succeed but also produced the intended output. Have a look at the example {{{examples/post-build-script.html}Using a Post Build Script}} for a code snippet. * Running Only Some Tests The plugin also supports a parameter <<<-Dinvoker.test>>> to run only ITs in the directories matched by the patterns used in the parameter. This enables you to quickly rerun individual tests. See this example command line: +--- mvn invoker:run -Dinvoker.test=*MWAR*,simple* +--- Assuming the base directory of the sub projects is <<>>, the plugin will only run projects from directories matching the path <<>> and <<>>. maven-invoker-plugin-1.5/src/site/apt/examples/0000755000175000017500000000000011623526250020337 5ustar tonytonymaven-invoker-plugin-1.5/src/site/apt/examples/skipping.apt.vm0000644000175000017500000000375211147523624023324 0ustar tonytony ------ Skipping Invocations ------ Mark Struberg ------ 2009-12-20 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Skipping Invocations The Invoker Plugin usually performs an installation setup and runs the configured Maven invocations. Since version 1.4 of the plugin all these steps may be skipped. To skip running the invocations for a particular project, set the <<>> property to <<>>. The artifact staging to a local repository can be skipped by setting the parameter <<>> to <<>>. +---+ ... org.apache.maven.plugins maven-invoker-plugin ${project.version} true true ... +---+ All these steps can also be omited via the command line by use of the <<>> property: +---+ mvn install -Dinvoker.skip=true +---+ maven-invoker-plugin-1.5/src/site/apt/examples/access-test-classes.apt.vm0000644000175000017500000000453011150750543025340 0ustar tonytony ------ Accessing Test Classes ------ Benjamin Bentmann ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Accessing Test Classes In case your pre-/post-build scripts perform complex operations that you would rather like to refactor out into some utility class instead of copy&pasting them in each script, you can use the parameter <<>>: +---- maven-invoker-plugin ${project.version} true integration-test run +---- Setting <<>> to <<>> will prepend the directories <<<$\{project.build.testOutputDirectory\}>>>, <<<$\{project.build.outputDirectory\}>>> and all dependencies of your project to the class path of the script interpreter. Among others, this allows you to create some utility classes in your test source tree and use this code for the hook scripts. Of course, this requires your test classes to be compiled before running the integration tests but this is usually the case if you employ the Invoker Plugin during the lifecycle phase <<>>. maven-invoker-plugin-1.5/src/site/apt/examples/selector-conditions.apt.vm0000644000175000017500000000534611267654610025473 0ustar tonytony ------ Selector Conditions ------ Benjamin Bentmann ------ 2009-09-19 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Selector Conditions Starting with plugin version 1.4, some keys of the {{{./invoker-properties.html}Invoker Properties}} can be used to skip individual projects based on the current JRE version or OS family as illustrated in the example below: ------------------- # build project if JRE version is 1.4 or higher, but exclude version 1.4.1 invoker.java.version = 1.4+, !1.4.1 # build project if OS family is not Windows invoker.os.family = !windows ------------------- In addition, with plugin version 1.5, there is the ability to skip individual projects based on the current Maven version as illustrated in the example below: ------------------- # build project if Maven version is 2.0.10 or higher, but exclude versions 2.1.0 and 2.2.0 invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0 ------------------- The values of these keys are comma separated tokens. A token prefixed with "!" denotes an exclusion, otherwise it denotes an inclusion. A project is build if no exclusion matches and if no inclusions are given or at least one of them matches the current environment. The tokens to describe versions can be suffixed with "+" or "-". The table below shows how the different styles of version tokens translate to a version range: *----------------+----------------------------+ || Version Token || Equivalent Version Range | *----------------+----------------------------+ | 1.5 | [1.5,1.6) | *----------------+----------------------------+ | 1.5+ | [1.5,) | *----------------+----------------------------+ | 1.5- | (,1.5) | *----------------+----------------------------+ For the OS family, the tokens "windows", "unix" and "mac" are supported. maven-invoker-plugin-1.5/src/site/apt/examples/integration-test-verify.apt.vm0000644000175000017500000000377511255413576026313 0ustar tonytony ------ Using with other integration test frameworks ------ Stephen Connolly ------ 2009-08-15 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Using with other integration test frameworks If you are using other integration test frameworks, or if you need to setup an integration test enviroment prior to test execution and tear that envronment down afterwards, then you need to use the <<>> and <<>> goals in place of <<>>. For example: +---- maven-invoker-plugin ${project.version} integration-test integration-test verify +---- This will allow any plugins bound to the <<>> phase to execute before the <<>> phase executes the <<>> goal that we have just bound. maven-invoker-plugin-1.5/src/site/apt/examples/prepare-build-env.apt.vm0000644000175000017500000000605211052072042025001 0ustar tonytony ------ Preparing the Build Environment ------ Benjamin Bentmann ------ 2008-08-17 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Preparing the Build Environment In general, the plugin assumes that the projects to build are unrelated to one other such that their build order does not matter. However, you might sometimes want to ensure that certain projects are build before others. As a motivation, imagine that a project performs some kind of common setup for the other projects, e.g. installing utility artifacts into the local repository. Starting with plugin version 1.3, you can declare a group of setup projects that must be run before all the other projects by means of the parameter <<<\>>> as shown in the following example: +---- maven-invoker-plugin ${project.version} utility-plugin/pom.xml */pom.xml integration-test run +---- This tells the plugin that the project <<>> must be run before the other projects selected by the pattern <<<*/pom.xml>>>. Please note that although the pattern <<<*/pom.xml>>> also matches the path <<>>, this project will not be run twice. In other words, any project selected by both <<<\>>> and <<<\>>> will only be run once, namely during the setup phase. The build order of several such setup projects is still undefined. So if the setup projects have inter-dependencies that require a certain build order, you should group them by an aggregator POM and feed that into the Invoker Plugin such that the correct build order will be determined by Maven's multi-module reactor. maven-invoker-plugin-1.5/src/site/apt/examples/selector-scripts.apt.vm0000644000175000017500000000537511267406352025011 0ustar tonytony ------ Selector Scripts ------ Stephen Connolly ------ 2009-10-20 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Selector Scripts Starting with plugin version 1.5, a custom script can be used to skip individual projects based on whatever critria are expressed in the script as illustrated in the following example. Assume the following directory structure: ------------------- ./ +- pom.xml +- src/ +- it/ +- settings.xml +- conditional-it/ +- pom.xml +- check-assumptions.bsh +- src/ ------------------- The plugin configuration for this example would look like this: ------------------- ... maven-invoker-plugin ${project.version} src/it \${project.build.directory}/it */pom.xml src/it/settings.xml \${project.build.directory}/local-repo check-assumptions.bsh integration-test install run ... ------------------- If the check-assumptions.bsh script returns <<>> or does not return a value, then the project will be executed. If the script returns any value other than <<>>, then the project will be executed. If the script throws an exception, then the project will be marked as being in ERROR. maven-invoker-plugin-1.5/src/site/apt/examples/fast-use.apt.vm0000644000175000017500000000670611064726676023243 0ustar tonytony ------ Fast Build Configuration ------ Olivier Lamy ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Fast Build Configuration If you follow the recommended approach and use a dedicated local repository for the integration tests (e.g. <<>>), you will likely encounter long build times. If the test repository has been cleaned, the plugin needs to re-download all artifacts from the central repo and the resulting network traffic slows the test execution down. But you can configure the plugin to download released artifacts from your local repo. This will work without optional settings with Maven >= 2.0.9 because many plugins versions are locked in the super POM. For older versions, you have to lock plugins versions. To enable this feature, you have to add a <<>> file in your project (for example in <<>>) and modify the plugin configuration as this: ------------------- ... org.apache.maven.plugins maven-invoker-plugin ${project.version} ... src/it/settings.xml ... ... ------------------- The settings must contain the following content which effectively tells Maven to use the local repository as a remote repository: ------------------- it-repo true local.central @localRepositoryUrl@ true true local.central @localRepositoryUrl@ true true ------------------- The token <<<@localRepositoryUrl@>>> will be automatically replaced by the Invoker Plugin with the URL to the local repository used for the Maven invocation. maven-invoker-plugin-1.5/src/site/apt/examples/invoker-properties.apt.vm0000644000175000017500000000736011255230257025343 0ustar tonytony ------ Invoker Properties ------ Benjamin Bentmann ------ 2008-08-09 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Invoker Properties The various parameters in the plugin configuration provide a means to globally configure the goals, profiles etc. used to run a Maven build on the projects. However, for certain projects you might want to specify different settings. To avoid the hassle of multiple plugin executions, you can simply use a file named <<>> to control the build settings on a per project basis. The exact name of this properties file is configurable but it needs to reside in the base directory of the respective project as shown below: ------------------- ./ +- src/ +- it/ +- test-project/ +- pom.xml +- invoker.properties +- src/ ------------------- There are only a few keys supported in this file and their names typically match the corresponding parameters in the plugin configuration. For a complete overview of supported properties, see the example given in the documentation of the plugin parameter <<<{{{../run-mojo.html#invokerPropertiesFile}invokerPropertiesFile}}>>>. The comments given in the example should be rather self-explanatory. Looking closely, you can also notice that the syntax <<<$\{expression\}>>> can be used to filter the property values. What deserves some more description is the possibility to perform several Maven builds on the same project. By default, the Invoker Plugin will perform the following steps for each project: * Run the pre build hook script if existent * Invoke Maven in the project directory * Run the post build hook script if existent [] Since plugin version 1.3, you can append a one-based index to the invoker properties in order to enable/configure further invocations of Maven. More precisely, <<>> specifies the goals for the first build, <<>> lists the goals for the second build and so on. These builds will be performed one after the other: * Run the pre build hook script if existent * Invoke Maven in the project directory * Invoke Maven in the project directory * ... * Invoke Maven in the project directory * Run the post build hook script if existent [] Most of the properties can be indexed this way, e.g. <<>> would specify the profiles to use for the third invocation. If the property <<>> was not defined, the plugin would query the property <<>> as a fallback to determine the profiles for the third build. This build loop ends after invocation if no property <<>> is defined. The invoker properties can also be used to skip projects based on the current JRE version or OS family. For more information on this feature, please see {{{./selector-conditions.html}Selector Conditions}}. maven-invoker-plugin-1.5/src/site/apt/examples/clone-projects.apt.vm0000644000175000017500000000551411051550451024415 0ustar tonytony ------ Cloning Projects ------ Paul Gier ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Cloning Projects By default the projects will be executed in the same directory where they are found. This means that build output will be generated with the project files. It may be helpful to copy the projects to another directory before running them, for example <<>>. This will allow <<>> to remove the output generated by all of the test projects. ------------------- ... maven-invoker-plugin ${project.version} src/it \${project.build.directory}/it integration-test run ... ------------------- There is another benefit of cloning the projects to a temporary location besides keeping the source tree free of build output. When the projects are not cloned, the plugin must use temporary POMs to perform their filtering. In contrast, cloning the projects enables the plugin to simply filter the cloned POMs in-place. Since a POM's file name remains unchanged this way, the inter-project dependencies expressed in the POMs via <<<\>>> and <<<\>>> elements remain intact, too. This in turn allows the plugin to filter all POMs that participate in a forked build rather than only the root POM of the execution. Last but not least, once the projects have been cloned and filtered by an execution of <<>>, you can browse to a cloned project and manually invoke Maven on it. This can be useful to debug the build. maven-invoker-plugin-1.5/src/site/apt/examples/post-build-script.apt.vm0000644000175000017500000001037211154730610025051 0ustar tonytony ------ Using a Post-Build Script ------ Paul Gier ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Using a Post-Build Script Here is an example of how the Invoker Plugin can be used to run a set of Maven projects and then verify their output with a {{{http://www.beanshell.org/}BeanShell}} or {{{http://groovy.codehaus.org/}Groovy}} script. The name of the script file in this case is <<>>. ------------------- maven-invoker-plugin ${project.version} true src/it setup.bsh verify.bsh integration-test run ------------------- Below is an example post-build BeanShell script (<<>>) that checks for the existence of a JAR file after the build has run. If the JAR file does not exist, the script throws an exception which causes the Invoker Plugin to log that the build failed. More precisely, any non-null return value which does not equal <<>> will be interpreted as a failure condition. And of course, if the script exists abnormally due to an exception, the plugin will flag the corresponding build as a failure, too. ------------------- import java.io.*; File file = new File( basedir, "target/my-test-project-1.0-SNAPSHOT.jar" ); if ( !file.isFile() ) { throw new FileNotFoundException( "Could not find generated JAR: " + file ); } ------------------- Complementary to the post-build hook script, you can also create a pre-build hook script that will be run before the invocation of Maven. This can be used to do some preparations for the build. To allow the scripts to access some useful data about the test project, the following global variables will be defined by the Invoker Plugin before running the script: *--------------------------+----------------------+-----------------------------------------------------------+--------+ || Name || Type || Description || Since | *--------------------------+----------------------+-----------------------------------------------------------+--------+ | <<>> | <<>> | The absolute path to the base directory of the test project. | 1.0 | *--------------------------+----------------------+-----------------------------------------------------------+--------+ | <<>>| <<>> | The absolute path to the local repository used for the Maven invocation on the test project. | 1.3 | *--------------------------+----------------------+-----------------------------------------------------------+--------+ | <<>> | <<>> | The storage of key-value pairs used to pass data from the pre-build hook script to the post-build hook script. | 1.4 | *--------------------------+----------------------+-----------------------------------------------------------+--------+ maven-invoker-plugin-1.5/src/site/apt/examples/filtering.apt.vm0000644000175000017500000001441011123250333023440 0ustar tonytony ------ Filtering Files ------ Benjamin Bentmann ------ 2008-08-30 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Filtering Files Some files of the sub projects can be filtered, i.e. special tokens will be replaced by some other string before the actual build is started. In detail, the following files will be filtered: * POM files selected by the include/exclude patterns. The tokens to be filtered must be enclosed in <<<@...@>>> to avoid interferences with Maven's normal POM interpolation, i.e. use <<<@project.version@>>> instead of <<<$\{project.version\}>>>. Starting with version 1.3, the plugin will also (recursively) filter all POM files referenced via <<<\>>> or <<<\>>> tags, if the projects are cloned to a temporary location. * The custom user setting file. Again, the tokens to be filtered in this file must be enclosed in <<<@...@>>>. * The invoker properties, the goals file and the profiles file. Tokens in these files must use the usual Maven syntax <<<$\{...\}>>>. [] The following example directory structure highlights the files which are filtered by the Invoker Plugin: ------------------- ./ +- pom.xml +- src/ +- it/ +- settings.xml <- Filtered +- aggregator-project/ +- child-module-1/ | +- pom.xml <- Filtered +- child-module-2/ | +- pom.xml <- Filtered +- pom.xml <- Filtered +- invoker.properties <- Filtered +- goals.txt <- Filtered +- profiles.txt <- Filtered ------------------- Below is the corresponding POM snippet for the plugin configuration: ------------------- another-value ... maven-invoker-plugin ${project.version} src/it \${project.build.directory}/it */pom.xml src/it/settings.xml some-value integration-test run ------------------- When filtering the files, the plugin searches various data sources for a token's replacement value in the order indicated below. The search terminates as soon as an existing replacement value has been found, i.e. the value is not <<>>. [[1]] Tokens of the form <<>> and <<>> will be expanded to the referenced POM value if possible, e.g. <<>> refers to the version given in the <<>> that executed the Invoker Plugin. If no such POM element exists, the value lookup continues as outlined next. [[2]] Built-in properties defined by the Invoker Plugin will be processed. See this table for a list of available built-in properties: *--------------------------+----------------------------------------------------------------------------------+--------+ || Built-in Property || Value || Since | *--------------------------+----------------------------------------------------------------------------------+--------+ | <<>> | The absolute path to the project base directory of the main build. | 1.1 | *--------------------------+----------------------------------------------------------------------------------+--------+ | <<>> | The <<>> URL to the project base directory of the main build. | 1.4 | *--------------------------+----------------------------------------------------------------------------------+--------+ | <<>> | The absolute path to the local repository used for the main build. | 1.2 | *--------------------------+----------------------------------------------------------------------------------+--------+ | <<>> | The <<>> URL to the local repository used for the main build. | 1.3 | *--------------------------+----------------------------------------------------------------------------------+--------+ [[3]] The properties given by the parameter <<>> in the plugin configuration will be consulted for a property whose key equals the token. For the example POM shown above, the value <<>> has been associated with the token <<>>. [[4]] The properties given by the POM's <<<\>>> section will be searched for a property whose key equals the token. Regarding the example POM, the value <<>> has been associated with the token <<>>. [] Tokens for which no replacement value could be determined will be left unchanged. maven-invoker-plugin-1.5/src/site/apt/examples/install-artifacts.apt.vm0000644000175000017500000000411111045265543025112 0ustar tonytony ------ Installing Artifacts ------ Paul Gier ------ 2008-08-02 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Installing Artifacts The following example shows a plugin configuration using the <<<{{{../install-mojo.html}invoker:install}}>>> goal. This will cause the project artifact(s) to be installed to a dedicated local repository before executing the projects. This can be helpful if you want to build your project and test the new artifacts artifact in a single step instead of installing first and then running tests. ------------------- ... maven-invoker-plugin ${project.version} src/it target/local-repo integration-test install run ... ------------------- maven-invoker-plugin-1.5/src/site/apt/index.apt0000644000175000017500000001251211255413576020346 0ustar tonytony ------ Introduction ------ Jason van Zyl ------ 2006-11-27 ------ ~~ 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. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Maven Invoker Plugin The Invoker Plugin is used to run a set of Maven projects. The plugin can determine whether each project execution is successful, and optionally can verify the output generated from a given project execution. This plugin is in particular handy to perform integration tests for other Maven plugins. The Invoker Plugin can be employed to run a set of test projects that have been designed to assert certain features of the plugin under test. * Goals Overview The plugin has four goals meant to participate in the default build lifecycle: * {{{./install-mojo.html}invoker:install}} copies the project artifacts and dependencies of the main build into a dedicated local repository to prepare the execution of the selected sub projects in an isolated environment. * {{{./integration-test-mojo.html}invoker:integration-test}} runs a set of Maven projects in a directory. * {{{./verify-mojo.html}invoker:verify}} verifies the result of <<>>. * {{{./run-mojo.html}invoker:run}} runs a set of Maven projects in a directory and verifies the result. This is equivalent to running both <<>> and <<>>. [] This last goal is intended for usage with the site lifecycle: * {{{./report-mojo.html}invoker:report}} integrates the results from previous builds into the site. [] * Usage General instructions on how to use the Invoker Plugin can be found on the {{{./usage.html}usage page}}. Some more specific use cases are described in the examples given below. Last but not least, users occasionally contribute additional examples, tips or errata to the {{{http://docs.codehaus.org/display/MAVENUSER/Invoker+Plugin}plugin's wiki page}}. In case you still have questions regarding the plugin's usage, please have a look at the {{{./faq.html}FAQ}} and feel free to contact the {{{./mail-lists.html}user mailing list}}. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the {{{./mail-lists.html}mail archive}}. If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our {{{./issue-tracking.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are welcome, too. Contributors can check out the project from our {{{./source-repository.html}source repository}} and will find supplementary information in the {{{http://maven.apache.org/guides/development/guide-helping.html}guide to helping with Maven}}. * Examples The following example configurations are available to illustrate selected use cases in more detail: * {{{./examples/clone-projects.html}Clone projects}} to a temporary directory before running. * {{{./examples/filtering.html}Filter files}} to introduce some updates before starting the build. * {{{./examples/install-artifacts.html}Install}} projects artifacts to a local repository before running. * {{{./examples/post-build-script.html}Run a BeanShell or Groovy script}} to verify project output. * {{{./examples/fast-use.html}Fast Invoker Plugin configuration}} to accelerate project execution. * {{{./examples/access-test-classes.html}Access test classes}} to share code between hook scripts. * {{{./examples/invoker-properties.html}Use Invoker Properties}} to configure goals, profiles etc. for individual projects. * {{{./examples/selector-conditions.html}Use Selector Conditions}} to skip projects based on JRE version or OS family. * {{{./examples/prepare-build-env.html}Prepare the Build Environment}} by building some setup projects before other projects. * {{{./examples/integration-test-verify.html}Using with other integration test frameworks}} by decoupling checking the results of the integration tests from executing the integration tests. [] You can also study some real-life usages of the Invoker Plugin by browsing its own integration tests which are located in the directory <<>> of the {{{./source-repository.html}project source tree}}. maven-invoker-plugin-1.5/src/site/fml/0000755000175000017500000000000011623526250016513 5ustar tonytonymaven-invoker-plugin-1.5/src/site/fml/faq.fml0000644000175000017500000000720111255413576017771 0ustar tonytony Why do I need to use this plugin?

It is essential that you provide some form of integration testing for your projects and the Invoker Plugin tries to make is easy for you to create integration tests for your Maven Plugins, new Lifecycles, or any other type of Maven component that you've created. Currently the Invoker Plugin forks Maven to execute the specified projects, but it is hoped that soon we will integrate the Maven Embedder into the mix to allow you run your projects in process for great speed.

How can I assert that the build of an IT project fails?

Sometimes you might want to test that error conditions are properly dealt with, i.e. fail a build. To assert a failure for a particular IT project, put the following setting into the properties file denoted by the plugin's invokerPropertiesFile parameter: invoker.buildResult=failure. Now, the failure of the IT build will be interpreted as a test success. Likewise, a successful IT build will be considered a test failure.

How can I share common code between the pre-/post-build scripts?

If you want to avoid copy&paste of lengthy code snippets within the hook scripts, you can move this code into a regular Java class. More precisely, you would place this utility code somewhere in your test source tree and set the plugin parameter addTestClassPath to true. For more details, please see the example Accessing Test Classes.

How can I invoke multiple Maven builds on the same IT project?

This is not supported in the plugin configuration but rather on a per project basis by means of the invoker properties. This way, you use properties like invoker.goals.2 to configure the goals for a second invocation of Maven. Have a look at the example about using Invoker Properties.

maven-invoker-plugin-1.5/src/main/0000755000175000017500000000000011623526250015715 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/0000755000175000017500000000000011623526250016636 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/0000755000175000017500000000000011623526250017425 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/apache/0000755000175000017500000000000011623526250020646 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/apache/maven/0000755000175000017500000000000011623526250021754 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/0000755000175000017500000000000011623526250023252 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/0000755000175000017500000000000011623526250024727 5ustar tonytonymaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/CompositeMap.java0000644000175000017500000001363711066145375030212 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.Collection; import java.util.Map; import java.util.Properties; import java.util.Set; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.introspection.ReflectionValueExtractor; /** * A map-like source to interpolate expressions. * * @author olamy * @since 22 nov. 07 * @version $Id: CompositeMap.java 698132 2008-09-23 10:54:53Z bentmann $ */ class CompositeMap implements Map { /** * The Maven project from which to extract interpolated values, never null. */ private MavenProject mavenProject; /** * The set of additional properties from which to extract interpolated values, never null. */ private Map properties; /** * Creates a new interpolation source backed by the specified Maven project and some user-specified properties. * * @param mavenProject The Maven project from which to extract interpolated values, must not be null. * @param properties The set of additional properties from which to extract interpolated values, may be * null. */ protected CompositeMap( MavenProject mavenProject, Map properties ) { if ( mavenProject == null ) { throw new IllegalArgumentException( "no project specified" ); } this.mavenProject = mavenProject; this.properties = properties == null ? new Properties() : properties; } /** * {@inheritDoc} * * @see java.util.Map#clear() */ public void clear() { // nothing here } /** * {@inheritDoc} * * @see java.util.Map#containsKey(java.lang.Object) */ public boolean containsKey( Object key ) { if ( !( key instanceof String ) ) { return false; } String expression = (String) key; if ( expression.startsWith( "project." ) || expression.startsWith( "pom." ) ) { try { Object evaluated = ReflectionValueExtractor.evaluate( expression, this.mavenProject ); if ( evaluated != null ) { return true; } } catch ( Exception e ) { // uhm do we have to throw a RuntimeException here ? } } return properties.containsKey( key ) || mavenProject.getProperties().containsKey( key ); } /** * {@inheritDoc} * * @see java.util.Map#containsValue(java.lang.Object) */ public boolean containsValue( Object value ) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#entrySet() */ public Set entrySet() { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#get(java.lang.Object) */ public Object get( Object key ) { if ( !( key instanceof String ) ) { return null; } String expression = (String) key; if ( expression.startsWith( "project." ) || expression.startsWith( "pom." ) ) { try { Object evaluated = ReflectionValueExtractor.evaluate( expression, this.mavenProject ); if ( evaluated != null ) { return evaluated; } } catch ( Exception e ) { // uhm do we have to throw a RuntimeException here ? } } Object value = properties.get( key ); return ( value != null ? value : this.mavenProject.getProperties().get( key ) ); } /** * {@inheritDoc} * * @see java.util.Map#isEmpty() */ public boolean isEmpty() { return this.mavenProject == null && this.mavenProject.getProperties().isEmpty() && this.properties.isEmpty(); } /** * {@inheritDoc} * * @see java.util.Map#keySet() */ public Set keySet() { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#put(java.lang.Object, java.lang.Object) */ public Object put( Object key, Object value ) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#putAll(java.util.Map) */ public void putAll( Map t ) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#remove(java.lang.Object) */ public Object remove( Object key ) { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#size() */ public int size() { throw new UnsupportedOperationException(); } /** * {@inheritDoc} * * @see java.util.Map#values() */ public Collection values() { throw new UnsupportedOperationException(); } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/AbstractInvokerMojo.java0000644000175000017500000021747011270330034031522 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.invoker.model.BuildJob; import org.apache.maven.plugin.invoker.model.io.xpp3.BuildJobXpp3Writer; import org.apache.maven.model.Model; import org.apache.maven.model.Profile; import org.apache.maven.shared.invoker.InvocationRequest; import org.apache.maven.shared.invoker.DefaultInvocationRequest; import org.apache.maven.shared.invoker.MavenCommandLineBuilder; import org.apache.maven.shared.invoker.CommandLineConfigurationException; import org.apache.maven.shared.invoker.InvocationResult; import org.apache.maven.shared.invoker.MavenInvocationException; import org.apache.maven.shared.invoker.Invoker; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Settings; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.DirectoryScanner; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.InterpolationFilterReader; import org.codehaus.plexus.util.WriterFactory; import org.codehaus.plexus.interpolation.Interpolator; import org.codehaus.plexus.interpolation.RegexBasedInterpolator; import org.codehaus.plexus.interpolation.MapBasedValueSource; import org.codehaus.plexus.interpolation.InterpolationException; import java.io.IOException; import java.io.File; import java.io.Reader; import java.io.FileOutputStream; import java.io.Writer; import java.io.OutputStreamWriter; import java.io.InputStream; import java.io.FileInputStream; import java.io.BufferedReader; import java.util.Collection; import java.util.LinkedHashSet; import java.util.Iterator; import java.util.List; import java.util.ArrayList; import java.util.Properties; import java.util.TreeSet; import java.util.Map; import java.util.LinkedHashMap; import java.util.Arrays; import java.util.HashMap; import java.util.StringTokenizer; import java.util.Collections; import java.util.Locale; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; /** * Provides common code for mojos invoking sub builds. * * @author Stephen Connolly * @since 15-Aug-2009 09:09:29 */ public abstract class AbstractInvokerMojo extends AbstractMojo { /** * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. * * @parameter expression="${invoker.skip}" default-value="false" * @since 1.1 */ private boolean skipInvocation; /** * Flag used to suppress the summary output notifying of successes and failures. If set to true, the * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the * main build should fail as well). If {@link #streamLogs} is enabled, the sub-build summary will also provide an * indication. * * @parameter default-value="false" */ protected boolean suppressSummaries; /** * Flag used to determine whether the build logs should be output to the normal mojo log. * * @parameter expression="${invoker.streamLogs}" default-value="false" */ private boolean streamLogs; /** * The local repository for caching artifacts. It is strongly recommended to specify a path to an isolated * repository like ${project.build.directory}/it-repo. Otherwise, your ordinary local repository will * be used, potentially soiling it with broken artifacts. * * @parameter expression="${invoker.localRepositoryPath}" default-value="${settings.localRepository}" */ private File localRepositoryPath; /** * Directory to search for integration tests. * * @parameter expression="${invoker.projectsDirectory}" default-value="${basedir}/src/it/" */ private File projectsDirectory; /** * Base directory where all build reports are written to. * * @parameter expression="${invoker.reportsDirectory}" default-value="${project.build.directory}/invoker-reports" * @since 1.4 */ private File reportsDirectory; /** * A flag to disable the generation of build reports. * * @parameter expression="${invoker.disableReports}" default-value="false" * @since 1.4 */ private boolean disableReports; /** * Directory to which projects should be cloned prior to execution. If not specified, each integration test will be * run in the directory in which the corresponding IT POM was found. In this case, you most likely want to configure * your SCM to ignore target and build.log in the test's base directory. * * @parameter * @since 1.1 */ private File cloneProjectsTo; /** * Some files are normally excluded when copying the IT projects from the directory specified by the parameter * projectsDirectory to the directory given by cloneProjectsTo (e.g. .svn, CVS, * *~, etc). Setting this parameter to true will cause all files to be copied to the * cloneProjectsTo directory. * * @parameter default-value="false" * @since 1.2 */ private boolean cloneAllFiles; /** * A single POM to build, skipping any scanning parameters and behavior. * * @parameter expression="${invoker.pom}" */ private File pom; /** * Include patterns for searching the integration test directory for projects. This parameter is meant to be set * from the POM. If this parameter is not set, the plugin will search for all pom.xml files one * directory below {@link #projectsDirectory} (i.e. */pom.xml).
*
* Starting with version 1.3, mere directories can also be matched by these patterns. For example, the include * pattern * will run Maven builds on all immediate sub directories of {@link #projectsDirectory}, * regardless if they contain a pom.xml. This allows to perform builds that need/should not depend on * the existence of a POM. * * @parameter */ private List pomIncludes = Collections.singletonList( "*/pom.xml" ); /** * Exclude patterns for searching the integration test directory. This parameter is meant to be set from the POM. By * default, no POM files are excluded. For the convenience of using an include pattern like *, the * custom settings file specified by the parameter {@link #settingsFile} will always be excluded automatically. * * @parameter */ private List pomExcludes = Collections.EMPTY_LIST; /** * Include patterns for searching the projects directory for projects that need to be run before the other projects. * This parameter allows to declare projects that perform setup tasks like installing utility artifacts into the * local repository. Projects matched by these patterns are implicitly excluded from the scan for ordinary projects. * Also, the exclusions defined by the parameter {@link #pomExcludes} apply to the setup projects, too. Default * value is: setup*/pom.xml. * * @parameter * @since 1.3 */ private List setupIncludes = Collections.singletonList( "setup*/pom.xml" ); /** * The list of goals to execute on each project. Default value is: package. * * @parameter */ private List goals = Collections.singletonList( "package" ); /** * The name of the project-specific file that contains the enumeration of goals to execute for that test. * * @parameter expression="${invoker.goalsFile}" default-value="goals.txt" * @deprecated As of version 1.2, the key invoker.goals from the properties file specified by the * parameter {@link #invokerPropertiesFile} should be used instead. */ private String goalsFile; /** * @component */ private Invoker invoker; /** * Relative path of a selector script to run prior in order to decide if the build should be executed. This script * may be written with either BeanShell or Groovy. If the file extension is omitted (e.g. selector), * the plugin searches for the file by trying out the well-known extensions .bsh and .groovy. * If this script exists for a particular project but returns any non-null value different from true, * the corresponding build is flagged as skipped. In this case, none of the pre-build hook script, * Maven nor the post-build hook script will be invoked. If this script throws an exception, the corresponding * build is flagged as in error, and none of the pre-build hook script, Maven not the post-build hook script will * be invoked. * * @parameter expression="${invoker.selectorScript}" default-value="selector" * @since 1.5 */ private String selectorScript; /** * Relative path of a pre-build hook script to run prior to executing the build. This script may be written with * either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. prebuild), the plugin * searches for the file by trying out the well-known extensions .bsh and .groovy. If this * script exists for a particular project but returns any non-null value different from true or throws * an exception, the corresponding build is flagged as a failure. In this case, neither Maven nor the post-build * hook script will be invoked. * * @parameter expression="${invoker.preBuildHookScript}" default-value="prebuild" */ private String preBuildHookScript; /** * Relative path of a cleanup/verification hook script to run after executing the build. This script may be written * with either BeanShell or Groovy (since 1.3). If the file extension is omitted (e.g. verify), the * plugin searches for the file by trying out the well-known extensions .bsh and .groovy. * If this script exists for a particular project but returns any non-null value different from true or * throws an exception, the corresponding build is flagged as a failure. * * @parameter expression="${invoker.postBuildHookScript}" default-value="postbuild" */ private String postBuildHookScript; /** * Location of a properties file that defines CLI properties for the test. * * @parameter expression="${invoker.testPropertiesFile}" default-value="test.properties" */ private String testPropertiesFile; /** * Common set of test properties to pass in on each IT's command line, via -D parameters. * * @parameter * @deprecated As of version 1.1, use the {@link #properties} parameter instead. */ private Properties testProperties; /** * Common set of properties to pass in on each project's command line, via -D parameters. * * @parameter * @since 1.1 */ private Map properties; /** * Whether to show errors in the build output. * * @parameter expression="${invoker.showErrors}" default-value="false" */ private boolean showErrors; /** * Whether to show debug statements in the build output. * * @parameter expression="${invoker.debug}" default-value="false" */ private boolean debug; /** * Suppress logging to the build.log file. * * @parameter expression="${invoker.noLog}" default-value="false" */ private boolean noLog; /** * List of profile identifiers to explicitly trigger in the build. * * @parameter * @since 1.1 */ private List profiles; /** * List of properties which will be used to interpolate goal files. * * @parameter * @since 1.1 * @deprecated As of version 1.3, the parameter {@link #filterProperties} should be used instead. */ private Properties interpolationsProperties; /** * A list of additional properties which will be used to filter tokens in POMs and goal files. * * @parameter * @since 1.3 */ private Map filterProperties; /** * The Maven Project Object * * @parameter expression="${project}" * @required * @readonly * @since 1.1 */ private MavenProject project; /** * A comma separated list of project names to run. Specify this parameter to run individual tests by file name, * overriding the {@link #setupIncludes}, {@link #pomIncludes} and {@link #pomExcludes} parameters. Each pattern you * specify here will be used to create an include pattern formatted like * ${projectsDirectory}/pattern, so you can just type * -Dinvoker.test=FirstTest,SecondTest to run builds in ${projectsDirectory}/FirstTest and * ${projectsDirectory}/SecondTest. * * @parameter expression="${invoker.test}" * @since 1.1 */ private String invokerTest; /** * The name of the project-specific file that contains the enumeration of profiles to use for that test. If the * file exists and is empty no profiles will be used even if the parameter {@link #profiles} is set. * * @parameter expression="${invoker.profilesFile}" default-value="profiles.txt" * @since 1.1 * @deprecated As of version 1.2, the key invoker.profiles from the properties file specified by the * parameter {@link #invokerPropertiesFile} should be used instead. */ private String profilesFile; /** * Path to an alternate settings.xml to use for Maven invocation with all ITs. Note that the * <localRepository> element of this settings file is always ignored, i.e. the path given by the * parameter {@link #localRepositoryPath} is dominant. * * @parameter expression="${invoker.settingsFile}" * @since 1.2 */ private File settingsFile; /** * The MAVEN_OPTS environment variable to use when invoking Maven. This value can be overridden for * individual integration tests by using {@link #invokerPropertiesFile}. * * @parameter expression="${invoker.mavenOpts}" * @since 1.2 */ private String mavenOpts; /** * The home directory of the Maven installation to use for the forked builds. Defaults to the current Maven * installation. * * @parameter expression="${invoker.mavenHome}" * @since 1.3 */ private File mavenHome; /** * The JAVA_HOME environment variable to use for forked Maven invocations. Defaults to the current Java * home directory. * * @parameter expression="${invoker.javaHome}" * @since 1.3 */ private File javaHome; /** * The file encoding for the pre-/post-build scripts and the list files for goals and profiles. * * @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}" * @since 1.2 */ private String encoding; /** * The current user system settings for use in Maven. * * @parameter expression="${settings}" * @required * @readonly * @since 1.2 */ private Settings settings; /** * A flag whether the test class path of the project under test should be included in the class path of the * pre-/post-build scripts. If set to false, the class path of script interpreter consists only of * the runtime dependencies of the Maven Invoker Plugin. If set the * true, the project's test class path will be prepended to the interpreter class path. Among * others, this feature allows the scripts to access utility classes from the test sources of your project. * * @parameter expression="${invoker.addTestClassPath}" default-value="false" * @since 1.2 */ private boolean addTestClassPath; /** * The test class path of the project under test. * * @parameter default-value="${project.testClasspathElements}" * @readonly */ private List testClassPath; /** * The name of an optional project-specific file that contains properties used to specify settings for an individual * Maven invocation. Any property present in the file will override the corresponding setting from the plugin * configuration. The values of the properties are filtered and may use expressions like * ${project.version} to reference project properties or values from the parameter * {@link #filterProperties}. The snippet below describes the supported properties: * *
     * # A comma or space separated list of goals/phases to execute, may
     * # specify an empty list to execute the default goal of the IT project
     * invoker.goals = clean install
     *
     * # Optionally, a list of goals to run during further invocations of Maven
     * invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:run
     *
     * # A comma or space separated list of profiles to activate
     * invoker.profiles = its,jdk15
     *
     * # The path to an alternative POM or base directory to invoke Maven on, defaults to the
     * # project that was originally specified in the plugin configuration
     * # Since plugin version 1.4
     * invoker.project = sub-module
     *
     * # The value for the environment variable MAVEN_OPTS
     * invoker.mavenOpts = -Dfile.encoding=UTF-16 -Xms32m -Xmx256m
     *
     * # Possible values are "fail-fast" (default), "fail-at-end" and "fail-never"
     * invoker.failureBehavior = fail-never
     *
     * # The expected result of the build, possible values are "success" (default) and "failure"
     * invoker.buildResult = failure
     *
     * # A boolean value controlling the aggregator mode of Maven, defaults to "false"
     * invoker.nonRecursive = true
     *
     * # A boolean value controlling the network behavior of Maven, defaults to "false"
     * # Since plugin version 1.4
     * invoker.offline = true
     *
     * # The path to the properties file from which to load system properties, defaults to the
     * # filename given by the plugin parameter testPropertiesFile
     * # Since plugin version 1.4
     * invoker.systemPropertiesFile = test.properties
     *
     * # An optional human friendly name for this build job to be included in the build reports.
     * # Since plugin version 1.4
     * invoker.name = Test Build 01
     *
     * # An optional description for this build job to be included in the build reports.
     * # Since plugin version 1.4
     * invoker.description = Checks the support for build reports.
     *
     * # A comma separated list of JRE versions on which this build job should be run.
     * # Since plugin version 1.4
     * invoker.java.version = 1.4+, !1.4.1, 1.7-
     *
     * # A comma separated list of OS families on which this build job should be run.
     * # Since plugin version 1.4
     * invoker.os.family = !windows, unix, mac 
     *
     * # A comma separated list of Maven versions on which this build should be run.
     * # Since plugin version 1.5
     * invoker.maven.version = 2.0.10+, !2.1.0, !2.2.0
     * 
* * @parameter expression="${invoker.invokerPropertiesFile}" default-value="invoker.properties" * @since 1.2 */ private String invokerPropertiesFile; /** * flag to enable show mvn version used for running its (cli option : -V,--show-version ) * @parameter expression="${invoker.showVersion}" default-value="false" * @since 1.4 */ private boolean showVersion; /** * The scripter runner that is responsible to execute hook scripts. */ private ScriptRunner scriptRunner; /** * A string used to prefix the file name of the filtered POMs in case the POMs couldn't be filtered in-place (i.e. * the projects were not cloned to a temporary directory), can be null. This will be set to * null if the POMs have already been filtered during cloning. */ private String filteredPomPrefix = "interpolated-"; /** * The format for elapsed build time. */ private final DecimalFormat secFormat = new DecimalFormat( "(0.0 s)", new DecimalFormatSymbols( Locale.ENGLISH ) ); /** * Invokes Maven on the configured test projects. * * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. */ public void execute() throws MojoExecutionException, MojoFailureException { if ( skipInvocation ) { getLog().info( "Skipping invocation per configuration." + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); return; } BuildJob[] buildJobs; if ( pom != null ) { try { projectsDirectory = pom.getCanonicalFile().getParentFile(); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to discover projectsDirectory from pom File parameter." + " Reason: " + e.getMessage(), e ); } buildJobs = new BuildJob[]{ new BuildJob( pom.getName(), BuildJob.Type.NORMAL )}; } else { try { buildJobs = getBuildJobs(); } catch ( final IOException e ) { throw new MojoExecutionException( "Error retrieving POM list from includes, excludes, " + "and projects directory. Reason: " + e.getMessage(), e ); } } if ( ( buildJobs == null ) || ( buildJobs.length < 1 ) ) { getLog().info( "No projects were selected for execution." ); return; } if ( StringUtils.isEmpty( encoding ) ) { getLog().warn( "File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!" ); } scriptRunner = new ScriptRunner( getLog() ); scriptRunner.setScriptEncoding( encoding ); scriptRunner.setGlobalVariable( "localRepositoryPath", localRepositoryPath ); scriptRunner.setClassPath( addTestClassPath ? testClassPath : null ); Collection collectedProjects = new LinkedHashSet(); for ( int i = 0; i < buildJobs.length; i++ ) { collectProjects( projectsDirectory, buildJobs[i].getProject(), collectedProjects, true ); } File projectsDir = projectsDirectory; if ( cloneProjectsTo != null ) { cloneProjects( collectedProjects ); projectsDir = cloneProjectsTo; } else { getLog().warn( "Filtering of parent/child POMs is not supported without cloning the projects" ); } runBuilds( projectsDir, buildJobs ); processResults( new InvokerSession( buildJobs ) ); } /** * Processes the results of invoking the build jobs. * * @param invokerSession The session with the build jobs, must not be null. * @throws MojoFailureException If the mojo had failed as a result of invoking the build jobs. * @since 1.4 */ abstract void processResults( InvokerSession invokerSession ) throws MojoFailureException; /** * Creates a new reader for the specified file, using the plugin's {@link #encoding} parameter. * * @param file The file to create a reader for, must not be null. * @return The reader for the file, never null. * @throws java.io.IOException If the specified file was not found or the configured encoding is not supported. */ private Reader newReader( File file ) throws IOException { if ( StringUtils.isNotEmpty( encoding ) ) { return ReaderFactory.newReader( file, encoding ); } else { return ReaderFactory.newPlatformReader( file ); } } /** * Collects all projects locally reachable from the specified project. The method will as such try to read the POM * and recursively follow its parent/module elements. * * @param projectsDir The base directory of all projects, must not be null. * @param projectPath The relative path of the current project, can denote either the POM or its base directory, * must not be null. * @param projectPaths The set of already collected projects to add new projects to, must not be null. * This set will hold the relative paths to either a POM file or a project base directory. * @param included A flag indicating whether the specified project has been explicitly included via the parameter * {@link #pomIncludes}. Such projects will always be added to the result set even if there is no * corresponding POM. * @throws org.apache.maven.plugin.MojoExecutionException If the project tree could not be traversed. */ private void collectProjects( File projectsDir, String projectPath, Collection projectPaths, boolean included ) throws MojoExecutionException { projectPath = projectPath.replace( '\\', '/' ); File pomFile = new File( projectsDir, projectPath ); if ( pomFile.isDirectory() ) { pomFile = new File( pomFile, "pom.xml" ); if ( !pomFile.exists() ) { if ( included ) { projectPaths.add( projectPath ); } return; } if ( !projectPath.endsWith( "/" ) ) { projectPath += '/'; } projectPath += "pom.xml"; } else if ( !pomFile.isFile() ) { return; } if ( !projectPaths.add( projectPath ) ) { return; } getLog().debug( "Collecting parent/child projects of " + projectPath ); Model model = PomUtils.loadPom( pomFile ); try { String projectsRoot = projectsDir.getCanonicalPath(); String projectDir = pomFile.getParent(); String parentPath = "../pom.xml"; if ( model.getParent() != null && StringUtils.isNotEmpty( model.getParent().getRelativePath() ) ) { parentPath = model.getParent().getRelativePath(); } String parent = relativizePath( new File( projectDir, parentPath ), projectsRoot ); if ( parent != null ) { collectProjects( projectsDir, parent, projectPaths, false ); } Collection modulePaths = new LinkedHashSet(); modulePaths.addAll( model.getModules() ); for ( Iterator it = model.getProfiles().iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); modulePaths.addAll( profile.getModules() ); } for ( Iterator it = modulePaths.iterator(); it.hasNext(); ) { String modulePath = (String) it.next(); String module = relativizePath( new File( projectDir, modulePath ), projectsRoot ); if ( module != null ) { collectProjects( projectsDir, module, projectPaths, false ); } } } catch ( IOException e ) { throw new MojoExecutionException( "Failed to analyze POM: " + pomFile, e ); } } /** * Copies the specified projects to the directory given by {@link #cloneProjectsTo}. A project may either be denoted * by a path to a POM file or merely by a path to a base directory. During cloning, the POM files will be filtered. * * @param projectPaths The paths to the projects to clone, relative to the projects directory, must not be * null nor contain null elements. * @throws org.apache.maven.plugin.MojoExecutionException If the the projects could not be copied/filtered. */ private void cloneProjects( Collection projectPaths ) throws MojoExecutionException { cloneProjectsTo.mkdirs(); // determine project directories to clone Collection dirs = new LinkedHashSet(); for ( Iterator it = projectPaths.iterator(); it.hasNext(); ) { String projectPath = (String) it.next(); if ( !new File( projectsDirectory, projectPath ).isDirectory() ) { projectPath = getParentPath( projectPath ); } dirs.add( projectPath ); } boolean filter = false; // clone project directories try { filter = !cloneProjectsTo.getCanonicalFile().equals( projectsDirectory.getCanonicalFile() ); List clonedSubpaths = new ArrayList(); for ( Iterator it = dirs.iterator(); it.hasNext(); ) { String subpath = (String) it.next(); // skip this project if its parent directory is also scheduled for cloning if ( !".".equals( subpath ) && dirs.contains( getParentPath( subpath ) ) ) { continue; } // avoid copying subdirs that are already cloned. if ( !alreadyCloned( subpath, clonedSubpaths ) ) { // avoid creating new files that point to dir/. if ( ".".equals( subpath ) ) { String cloneSubdir = relativizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() ); // avoid infinite recursion if the cloneTo path is a subdirectory. if ( cloneSubdir != null ) { File temp = File.createTempFile( "pre-invocation-clone.", "" ); temp.delete(); temp.mkdirs(); copyDirectoryStructure( projectsDirectory, temp ); FileUtils.deleteDirectory( new File( temp, cloneSubdir ) ); copyDirectoryStructure( temp, cloneProjectsTo ); } else { copyDirectoryStructure( projectsDirectory, cloneProjectsTo ); } } else { File srcDir = new File( projectsDirectory, subpath ); File dstDir = new File( cloneProjectsTo, subpath ); copyDirectoryStructure( srcDir, dstDir ); } clonedSubpaths.add( subpath ); } } } catch ( IOException e ) { throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: " + cloneProjectsTo + ". Reason: " + e.getMessage(), e ); } // filter cloned POMs if ( filter ) { for ( Iterator it = projectPaths.iterator(); it.hasNext(); ) { String projectPath = (String) it.next(); File pomFile = new File( cloneProjectsTo, projectPath ); if ( pomFile.isFile() ) { buildInterpolatedFile( pomFile, pomFile ); } } filteredPomPrefix = null; } } /** * Gets the parent path of the specified relative path. * * @param path The relative path whose parent should be retrieved, must not be null. * @return The parent path or "." if the specified path has no parent, never null. */ private String getParentPath( String path ) { int lastSep = Math.max( path.lastIndexOf( '/' ), path.lastIndexOf( '\\' ) ); return ( lastSep < 0 ) ? "." : path.substring( 0, lastSep ); } /** * Copied a directory structure with deafault exclusions (.svn, CVS, etc) * * @param sourceDir The source directory to copy, must not be null. * @param destDir The target directory to copy to, must not be null. * @throws java.io.IOException If the directory structure could not be copied. */ private void copyDirectoryStructure( File sourceDir, File destDir ) throws IOException { DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( sourceDir ); if ( !cloneAllFiles ) { scanner.addDefaultExcludes(); } scanner.scan(); /* * NOTE: Make sure the destination directory is always there (even if empty) to support POM-less ITs. */ destDir.mkdirs(); String[] includedDirs = scanner.getIncludedDirectories(); for ( int i = 0; i < includedDirs.length; ++i ) { File clonedDir = new File( destDir, includedDirs[i] ); clonedDir.mkdirs(); } String[] includedFiles = scanner.getIncludedFiles(); for ( int i = 0; i < includedFiles.length; ++i ) { File sourceFile = new File( sourceDir, includedFiles[i] ); File destFile = new File( destDir, includedFiles[i] ); FileUtils.copyFile( sourceFile, destFile ); } } /** * Determines whether the specified sub path has already been cloned, i.e. whether one of its ancestor directories * was already cloned. * * @param subpath The sub path to check, must not be null. * @param clonedSubpaths The list of already cloned paths, must not be null nor contain * null elements. * @return true if the specified path has already been cloned, false otherwise. */ static boolean alreadyCloned( String subpath, List clonedSubpaths ) { for ( Iterator iter = clonedSubpaths.iterator(); iter.hasNext(); ) { String path = (String) iter.next(); if ( ".".equals( path ) || subpath.equals( path ) || subpath.startsWith( path + File.separator ) ) { return true; } } return false; } /** * Runs the specified build jobs. * * @param projectsDir The base directory of all projects, must not be null. * @param buildJobs The build jobs to run must not be null nor contain null elements. * @throws org.apache.maven.plugin.MojoExecutionException If any build could not be launched. */ private void runBuilds( File projectsDir, BuildJob[] buildJobs ) throws MojoExecutionException { if ( !localRepositoryPath.exists() ) { localRepositoryPath.mkdirs(); } File interpolatedSettingsFile = null; if ( settingsFile != null ) { if ( cloneProjectsTo != null ) { interpolatedSettingsFile = new File( cloneProjectsTo, "interpolated-" + settingsFile.getName() ); } else { interpolatedSettingsFile = new File( settingsFile.getParentFile(), "interpolated-" + settingsFile.getName() ); } buildInterpolatedFile( settingsFile, interpolatedSettingsFile ); } try { for ( int i = 0; i < buildJobs.length; i++ ) { BuildJob project = buildJobs[i]; runBuild( projectsDir, project, interpolatedSettingsFile ); } } finally { if ( interpolatedSettingsFile != null && cloneProjectsTo == null ) { interpolatedSettingsFile.delete(); } } } /** * Runs the specified project. * * @param projectsDir The base directory of all projects, must not be null. * @param buildJob The build job to run, must not be null. * @param settingsFile The (already interpolated) user settings file for the build, may be null to use * the current user settings. * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. */ private void runBuild( File projectsDir, BuildJob buildJob, File settingsFile ) throws MojoExecutionException { File pomFile = new File( projectsDir, buildJob.getProject() ); File basedir; if ( pomFile.isDirectory() ) { basedir = pomFile; pomFile = new File( basedir, "pom.xml" ); if ( !pomFile.exists() ) { pomFile = null; } else { buildJob.setProject( buildJob.getProject() + File.separator + "pom.xml" ); } } else { basedir = pomFile.getParentFile(); } getLog().info( "Building: " + buildJob.getProject() ); File interpolatedPomFile = null; if ( pomFile != null ) { if ( filteredPomPrefix != null ) { interpolatedPomFile = new File( basedir, filteredPomPrefix + pomFile.getName() ); buildInterpolatedFile( pomFile, interpolatedPomFile ); } else { interpolatedPomFile = pomFile; } } InvokerProperties invokerProperties = getInvokerProperties( basedir ); // let's set what details we can buildJob.setName( invokerProperties.getJobName() ); buildJob.setDescription( invokerProperties.getJobDescription() ); try { if ( isSelected( invokerProperties ) ) { long milliseconds = System.currentTimeMillis(); boolean executed; try { executed = runBuild( basedir, interpolatedPomFile, settingsFile, invokerProperties ); } finally { milliseconds = System.currentTimeMillis() - milliseconds; buildJob.setTime( milliseconds / 1000.0 ); } if ( executed ) { buildJob.setResult( BuildJob.Result.SUCCESS ); if ( !suppressSummaries ) { getLog().info( "..SUCCESS " + formatTime( buildJob.getTime() ) ); } } else { buildJob.setResult( BuildJob.Result.SKIPPED ); if ( !suppressSummaries ) { getLog().info( "..SKIPPED " + formatTime( buildJob.getTime() ) ); } } } else { buildJob.setResult( BuildJob.Result.SKIPPED ); if ( !suppressSummaries ) { getLog().info( "..SKIPPED " ); } } } catch ( BuildErrorException e ) { buildJob.setResult( BuildJob.Result.ERROR ); buildJob.setFailureMessage( e.getMessage() ); if ( !suppressSummaries ) { getLog().info( "..ERROR " + formatTime( buildJob.getTime() ) ); getLog().info( " " + e.getMessage() ); } } catch ( BuildFailureException e ) { buildJob.setResult( e.getType() ); buildJob.setFailureMessage( e.getMessage() ); if ( !suppressSummaries ) { getLog().info( "..FAILED " + formatTime( buildJob.getTime() ) ); getLog().info( " " + e.getMessage() ); } } finally { if ( interpolatedPomFile != null && StringUtils.isNotEmpty( filteredPomPrefix ) ) { interpolatedPomFile.delete(); } writeBuildReport( buildJob ); } } /** * Determines whether selector conditions of the specified invoker properties match the current environment. * * @param invokerProperties The invoker properties to check, must not be null. * @return true if the job corresponding to the properties should be run, false otherwise. */ private boolean isSelected( InvokerProperties invokerProperties ) { if ( !SelectorUtils.isMavenVersion( invokerProperties.getMavenVersion() ) ) { return false; } if ( !SelectorUtils.isJreVersion( invokerProperties.getJreVersion() ) ) { return false; } if ( !SelectorUtils.isOsFamily( invokerProperties.getOsFamily() ) ) { return false; } return true; } /** * Writes the XML report for the specified build job unless report generation has been disabled. * * @param buildJob The build job whose report should be written, must not be null. * @throws org.apache.maven.plugin.MojoExecutionException If the report could not be written. */ private void writeBuildReport( BuildJob buildJob ) throws MojoExecutionException { if ( disableReports ) { return; } if ( !reportsDirectory.exists() ) { reportsDirectory.mkdirs(); } String safeFileName = buildJob.getProject().replace( '/', '_' ).replace( '\\', '_' ).replace( ' ', '_' ); if ( safeFileName.endsWith( "_pom.xml" ) ) { safeFileName = safeFileName.substring( 0, safeFileName.length() - "_pom.xml".length() ); } File reportFile = new File( reportsDirectory, "BUILD-" + safeFileName + ".xml" ); try { FileOutputStream fos = new FileOutputStream( reportFile ); try { Writer osw = new OutputStreamWriter( fos, buildJob.getModelEncoding() ); BuildJobXpp3Writer writer = new BuildJobXpp3Writer(); writer.write( osw, buildJob ); osw.close(); } finally { fos.close(); } } catch ( IOException e ) { throw new MojoExecutionException( "Failed to write build report " + reportFile, e ); } } /** * Formats the specified build duration time. * * @param seconds The duration of the build. * @return The formatted time, never null. */ private String formatTime( double seconds ) { return secFormat.format( seconds ); } /** * Runs the specified project. * * @param basedir The base directory of the project, must not be null. * @param pomFile The (already interpolated) POM file, may be null for a POM-less Maven invocation. * @param settingsFile The (already interpolated) user settings file for the build, may be null to use * the current user settings. * @param invokerProperties The properties to use. * @return true if the project was launched or false if the selector script indicated that * the project should be skipped. * @throws org.apache.maven.plugin.MojoExecutionException If the project could not be launched. * @throws org.apache.maven.plugin.invoker.BuildFailureException If either a hook script or the build itself failed. */ private boolean runBuild( File basedir, File pomFile, File settingsFile, InvokerProperties invokerProperties ) throws MojoExecutionException, BuildFailureException { if ( getLog().isDebugEnabled() && !invokerProperties.getProperties().isEmpty() ) { Properties props = invokerProperties.getProperties(); getLog().debug( "Using invoker properties:" ); for ( Iterator it = new TreeSet( props.keySet() ).iterator(); it.hasNext(); ) { String key = (String) it.next(); String value = props.getProperty( key ); getLog().debug( " " + key + " = " + value ); } } List goals = getGoals( basedir ); List profiles = getProfiles( basedir ); Map context = new LinkedHashMap(); FileLogger logger = setupLogger( basedir ); try { try { scriptRunner.run( "selector script", basedir, selectorScript, context, logger, BuildJob.Result.SKIPPED, false ); } catch ( BuildErrorException e ) { throw e; } catch ( BuildFailureException e ) { return false; } scriptRunner.run( "pre-build script", basedir, preBuildHookScript, context, logger, BuildJob.Result.FAILURE_PRE_HOOK, false ); final InvocationRequest request = new DefaultInvocationRequest(); request.setLocalRepositoryDirectory( localRepositoryPath ); request.setUserSettingsFile( settingsFile ); request.setInteractive( false ); request.setShowErrors( showErrors ); request.setDebug( debug ); request.setShowVersion( showVersion ); if ( logger != null ) { request.setErrorHandler( logger ); request.setOutputHandler( logger ); } if ( mavenHome != null ) { invoker.setMavenHome( mavenHome ); request.addShellEnvironment( "M2_HOME", mavenHome.getAbsolutePath() ); } if ( javaHome != null ) { request.setJavaHome( javaHome ); } for ( int invocationIndex = 1;; invocationIndex++ ) { if ( invocationIndex > 1 && !invokerProperties.isInvocationDefined( invocationIndex ) ) { break; } request.setBaseDirectory( basedir ); request.setPomFile( pomFile ); request.setGoals( goals ); request.setProfiles( profiles ); request.setMavenOpts( mavenOpts ); request.setOffline( false ); Properties systemProperties = getSystemProperties( basedir, invokerProperties.getSystemPropertiesFile( invocationIndex ) ); request.setProperties( systemProperties ); invokerProperties.configureInvocation( request, invocationIndex ); if ( getLog().isDebugEnabled() ) { try { getLog().debug( "Using MAVEN_OPTS: " + request.getMavenOpts() ); getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) ); } catch ( CommandLineConfigurationException e ) { getLog().debug( "Failed to display command line: " + e.getMessage() ); } } InvocationResult result; try { result = invoker.execute( request ); } catch ( final MavenInvocationException e ) { getLog().debug( "Error invoking Maven: " + e.getMessage(), e ); throw new BuildFailureException( "Maven invocation failed. " + e.getMessage(), BuildJob.Result.FAILURE_BUILD ); } verify( result, invocationIndex, invokerProperties, logger ); } scriptRunner.run( "post-build script", basedir, postBuildHookScript, context, logger, BuildJob.Result.FAILURE_POST_HOOK, true ); } finally { if ( logger != null ) { logger.close(); } } return true; } /** * Initializes the build logger for the specified project. * * @param basedir The base directory of the project, must not be null. * @return The build logger or null if logging has been disabled. * @throws org.apache.maven.plugin.MojoExecutionException If the log file could not be created. */ private FileLogger setupLogger( File basedir ) throws MojoExecutionException { FileLogger logger = null; if ( !noLog ) { File outputLog = new File( basedir, "build.log" ); try { if ( streamLogs ) { logger = new FileLogger( outputLog, getLog() ); } else { logger = new FileLogger( outputLog ); } getLog().debug( "build log initialized in: " + outputLog ); } catch ( IOException e ) { throw new MojoExecutionException( "Error initializing build logfile in: " + outputLog, e ); } } return logger; } /** * Gets the system properties to use for the specified project. * * @param basedir The base directory of the project, must not be null. * @param filename The filename to the properties file to load, may be null to use the default path * given by {@link #testPropertiesFile}. * @return The system properties to use, may be empty but never null. * @throws org.apache.maven.plugin.MojoExecutionException If the properties file exists but could not be read. */ private Properties getSystemProperties( final File basedir, final String filename ) throws MojoExecutionException { Properties collectedTestProperties = new Properties(); if ( testProperties != null ) { collectedTestProperties.putAll( testProperties ); } if ( properties != null ) { collectedTestProperties.putAll( properties ); } File propertiesFile = null; if ( filename != null ) { propertiesFile = new File( basedir, filename ); } else if ( testPropertiesFile != null ) { propertiesFile = new File( basedir, testPropertiesFile ); } if ( propertiesFile != null && propertiesFile.isFile() ) { InputStream fin = null; try { fin = new FileInputStream( propertiesFile ); Properties loadedProperties = new Properties(); loadedProperties.load( fin ); collectedTestProperties.putAll( loadedProperties ); } catch ( IOException e ) { throw new MojoExecutionException( "Error reading system properties from " + propertiesFile ); } finally { IOUtil.close( fin ); } } return collectedTestProperties; } /** * Verifies the invocation result. * * @param result The invocation result to check, must not be null. * @param invocationIndex The index of the invocation for which to check the exit code, must not be negative. * @param invokerProperties The invoker properties used to check the exit code, must not be null. * @param logger The build logger, may be null if logging is disabled. * @throws org.apache.maven.plugin.invoker.BuildFailureException If the invocation result indicates a build failure. */ private void verify( InvocationResult result, int invocationIndex, InvokerProperties invokerProperties, FileLogger logger ) throws BuildFailureException { if ( result.getExecutionException() != null ) { throw new BuildFailureException( "The Maven invocation failed. " + result.getExecutionException().getMessage(), BuildJob.Result.ERROR ); } else if ( !invokerProperties.isExpectedResult( result.getExitCode(), invocationIndex ) ) { StringBuffer buffer = new StringBuffer( 256 ); buffer.append( "The build exited with code " ).append( result.getExitCode() ).append( ". " ); if ( logger != null ) { buffer.append( "See " ); buffer.append( logger.getOutputFile().getAbsolutePath() ); buffer.append( " for details." ); } else { buffer.append( "See console output for details." ); } throw new BuildFailureException( buffer.toString(), BuildJob.Result.FAILURE_BUILD ); } } /** * Gets the goal list for the specified project. * * @param basedir The base directory of the project, must not be null. * @return The list of goals to run when building the project, may be empty but never null. * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. */ List getGoals( final File basedir ) throws MojoExecutionException { try { return getTokens( basedir, goalsFile, goals ); } catch ( IOException e ) { throw new MojoExecutionException( "error reading goals", e ); } } /** * Gets the profile list for the specified project. * * @param basedir The base directory of the project, must not be null. * @return The list of profiles to activate when building the project, may be empty but never null. * @throws org.apache.maven.plugin.MojoExecutionException If the profile file could not be read. */ List getProfiles( File basedir ) throws MojoExecutionException { try { return getTokens( basedir, profilesFile, profiles ); } catch ( IOException e ) { throw new MojoExecutionException( "error reading profiles", e ); } } /** * Gets the build jobs that should be processed. Note that the order of the returned build jobs is significant. * * @return The build jobs to process, may be empty but never null. * @throws java.io.IOException If the projects directory could not be scanned. */ BuildJob[] getBuildJobs() throws IOException { BuildJob[] buildJobs; if ( ( pom != null ) && pom.exists() ) { buildJobs = new BuildJob[] { new BuildJob( pom.getAbsolutePath(), BuildJob.Type.NORMAL ) }; } else if ( invokerTest != null ) { String[] testRegexes = StringUtils.split( invokerTest, "," ); List /* String */includes = new ArrayList( testRegexes.length ); for ( int i = 0, size = testRegexes.length; i < size; i++ ) { // user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml includes.add( testRegexes[i] ); } // it would be nice if we could figure out what types these are... but perhaps // not necessary for the -Dinvoker.test=xxx t buildJobs = scanProjectsDirectory( includes, null, BuildJob.Type.DIRECT ); } else { List excludes = ( pomExcludes != null ) ? new ArrayList( pomExcludes ) : new ArrayList(); if ( this.settingsFile != null ) { String exclude = relativizePath( this.settingsFile, projectsDirectory.getCanonicalPath() ); if ( exclude != null ) { excludes.add( exclude.replace( '\\', '/' ) ); getLog().debug( "Automatically excluded " + exclude + " from project scanning" ); } } BuildJob[] setupPoms = scanProjectsDirectory( setupIncludes, excludes, BuildJob.Type.SETUP ); getLog().debug( "Setup projects: " + Arrays.asList( setupPoms ) ); BuildJob[] normalPoms = scanProjectsDirectory( pomIncludes, excludes, BuildJob.Type.NORMAL ); Map uniquePoms = new LinkedHashMap(); for ( int i = 0; i < setupPoms.length; i++ ) { uniquePoms.put( setupPoms[i].getProject(), setupPoms[i] ); } for ( int i = 0; i < normalPoms.length; i++ ) { if ( !uniquePoms.containsKey( normalPoms[i].getProject() ) ) { uniquePoms.put( normalPoms[i].getProject(), normalPoms[i] ); } } buildJobs = (BuildJob[]) uniquePoms.values().toArray( new BuildJob[uniquePoms.size()] ); } relativizeProjectPaths( buildJobs ); return buildJobs; } /** * Scans the projects directory for projects to build. Both (POM) files and mere directories will be matched by the * scanner patterns. If the patterns match a directory which contains a file named "pom.xml", the results will * include the path to this file rather than the directory path in order to avoid duplicate invocations of the same * project. * * @param includes The include patterns for the scanner, may be null. * @param excludes The exclude patterns for the scanner, may be null to exclude nothing. * @param type The type to assign to the resulting build jobs, must not be null. * @return The build jobs matching the patterns, never null. * @throws java.io.IOException If the project directory could not be scanned. */ private BuildJob[] scanProjectsDirectory( List includes, List excludes, String type ) throws IOException { if ( !projectsDirectory.isDirectory() ) { return new BuildJob[0]; } DirectoryScanner scanner = new DirectoryScanner(); scanner.setBasedir( projectsDirectory.getCanonicalFile() ); scanner.setFollowSymlinks( false ); if ( includes != null ) { scanner.setIncludes( (String[]) includes.toArray( new String[includes.size()] ) ); } if ( excludes != null ) { scanner.setExcludes( (String[]) excludes.toArray( new String[excludes.size()] ) ); } scanner.addDefaultExcludes(); scanner.scan(); Map matches = new LinkedHashMap(); String[] includedFiles = scanner.getIncludedFiles(); for ( int i = 0; i < includedFiles.length; i++ ) { matches.put( includedFiles[i], new BuildJob( includedFiles[i], type ) ); } String[] includedDirs = scanner.getIncludedDirectories(); for ( int i = 0; i < includedDirs.length; i++ ) { String includedFile = includedDirs[i] + File.separatorChar + "pom.xml"; if ( new File( scanner.getBasedir(), includedFile ).isFile() ) { matches.put( includedFile, new BuildJob( includedFile, type ) ); } else { matches.put( includedDirs[i], new BuildJob( includedDirs[i], type ) ); } } return (BuildJob[]) matches.values().toArray( new BuildJob[matches.size()] ); } /** * Relativizes the project paths of the specified build jobs against the directory specified by * {@link #projectsDirectory} (if possible). If a project path does not denote a sub path of the projects directory, * it is returned as is. * * @param buildJobs The build jobs whose project paths should be relativized, must not be null nor * contain null elements. * @throws java.io.IOException If any path could not be relativized. */ private void relativizeProjectPaths( BuildJob[] buildJobs ) throws IOException { String projectsDirPath = projectsDirectory.getCanonicalPath(); for ( int i = 0; i < buildJobs.length; i++ ) { String projectPath = buildJobs[i].getProject(); File file = new File( projectPath ); if ( !file.isAbsolute() ) { file = new File( projectsDirectory, projectPath ); } String relativizedPath = relativizePath( file, projectsDirPath ); if ( relativizedPath == null ) { relativizedPath = projectPath; } buildJobs[i].setProject( relativizedPath ); } } /** * Relativizes the specified path against the given base directory. Besides relativization, the returned path will * also be normalized, e.g. directory references like ".." will be removed. * * @param path The path to relativize, must not be null. * @param basedir The (canonical path of the) base directory to relativize against, must not be null. * @return The relative path in normal form or null if the input path does not denote a sub path of the * base directory. * @throws java.io.IOException If the path could not be relativized. */ private String relativizePath( File path, String basedir ) throws IOException { String relativizedPath = path.getCanonicalPath(); if ( relativizedPath.startsWith( basedir ) ) { relativizedPath = relativizedPath.substring( basedir.length() ); if ( relativizedPath.startsWith( File.separator ) ) { relativizedPath = relativizedPath.substring( File.separator.length() ); } return relativizedPath; } else { return null; } } /** * Returns the map-based value source used to interpolate POMs and other stuff. * * @return The map-based value source for interpolation, never null. */ private Map getInterpolationValueSource() { Map props = new HashMap(); if ( interpolationsProperties != null ) { props.putAll( interpolationsProperties ); } if ( filterProperties != null ) { props.putAll( filterProperties ); } props.put( "basedir", this.project.getBasedir().getAbsolutePath() ); props.put( "baseurl", toUrl( this.project.getBasedir().getAbsolutePath() ) ); if ( settings.getLocalRepository() != null ) { props.put( "localRepository", settings.getLocalRepository() ); props.put( "localRepositoryUrl", toUrl( settings.getLocalRepository() ) ); } return new CompositeMap( this.project, props ); } /** * Converts the specified filesystem path to a URL. The resulting URL has no trailing slash regardless whether the * path denotes a file or a directory. * * @param filename The filesystem path to convert, must not be null. * @return The file: URL for the specified path, never null. */ private static String toUrl( String filename ) { /* * NOTE: Maven fails to properly handle percent-encoded "file:" URLs (WAGON-111) so don't use File.toURI() here * as-is but use the decoded path component in the URL. */ String url = "file://" + new File( filename ).toURI().getPath(); if ( url.endsWith( "/" ) ) { url = url.substring( 0, url.length() - 1 ); } return url; } /** * Gets goal/profile names for the specified project, either directly from the plugin configuration or from an * external token file. * * @param basedir The base directory of the test project, must not be null. * @param filename The (simple) name of an optional file in the project base directory from which to read * goals/profiles, may be null. * @param defaultTokens The list of tokens to return in case the specified token file does not exist, may be * null. * @return The list of goal/profile names, may be empty but never null. * @throws java.io.IOException If the token file exists but could not be parsed. */ private List getTokens( File basedir, String filename, List defaultTokens ) throws IOException { List tokens = ( defaultTokens != null ) ? defaultTokens : new ArrayList(); if ( StringUtils.isNotEmpty( filename ) ) { File tokenFile = new File( basedir, filename ); if ( tokenFile.exists() ) { tokens = readTokens( tokenFile ); } } return tokens; } /** * Reads the tokens from the specified file. Tokens are separated either by line terminators or commas. During * parsing, the file contents will be interpolated. * * @param tokenFile The file to read the tokens from, must not be null. * @return The list of tokens, may be empty but never null. * @throws java.io.IOException If the token file could not be read. */ private List readTokens( final File tokenFile ) throws IOException { List result = new ArrayList(); BufferedReader reader = null; try { Map composite = getInterpolationValueSource(); reader = new BufferedReader( new InterpolationFilterReader( newReader( tokenFile ), composite ) ); String line = null; while ( ( line = reader.readLine() ) != null ) { result.addAll( collectListFromCSV( line ) ); } } finally { IOUtil.close( reader ); } return result; } /** * Gets a list of comma separated tokens from the specified line. * * @param csv The line with comma separated tokens, may be null. * @return The list of tokens from the line, may be empty but never null. */ private List collectListFromCSV( final String csv ) { final List result = new ArrayList(); if ( ( csv != null ) && ( csv.trim().length() > 0 ) ) { final StringTokenizer st = new StringTokenizer( csv, "," ); while ( st.hasMoreTokens() ) { result.add( st.nextToken().trim() ); } } return result; } /** * Interpolates the specified POM/settings file to a temporary file. The destination file may be same as the input * file, i.e. interpolation can be performed in-place. * * @param originalFile The XML file to interpolate, must not be null. * @param interpolatedFile The target file to write the interpolated contents of the original file to, must not be * null. * @throws org.apache.maven.plugin.MojoExecutionException If the target file could not be created. */ void buildInterpolatedFile( File originalFile, File interpolatedFile ) throws MojoExecutionException { getLog().debug( "Interpolate " + originalFile.getPath() + " to " + interpolatedFile.getPath() ); try { String xml; Reader reader = null; try { // interpolation with token @...@ Map composite = getInterpolationValueSource(); reader = ReaderFactory.newXmlReader( originalFile ); reader = new InterpolationFilterReader( reader, composite, "@", "@" ); xml = IOUtil.toString( reader ); } finally { IOUtil.close( reader ); } Writer writer = null; try { interpolatedFile.getParentFile().mkdirs(); writer = WriterFactory.newXmlWriter( interpolatedFile ); writer.write( xml ); writer.flush(); } finally { IOUtil.close( writer ); } } catch ( IOException e ) { throw new MojoExecutionException( "Failed to interpolate file " + originalFile.getPath(), e ); } } /** * Gets the (interpolated) invoker properties for an integration test. * * @param projectDirectory The base directory of the IT project, must not be null. * @return The invoker properties, may be empty but never null. * @throws org.apache.maven.plugin.MojoExecutionException If an I/O error occurred during reading the properties. */ private InvokerProperties getInvokerProperties( final File projectDirectory ) throws MojoExecutionException { Properties props = new Properties(); if ( invokerPropertiesFile != null ) { File propertiesFile = new File( projectDirectory, invokerPropertiesFile ); if ( propertiesFile.isFile() ) { InputStream in = null; try { in = new FileInputStream( propertiesFile ); props.load( in ); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to read invoker properties: " + propertiesFile, e ); } finally { IOUtil.close( in ); } } Interpolator interpolator = new RegexBasedInterpolator(); interpolator.addValueSource( new MapBasedValueSource( getInterpolationValueSource() ) ); for ( Iterator it = props.keySet().iterator(); it.hasNext(); ) { String key = (String) it.next(); String value = props.getProperty( key ); try { value = interpolator.interpolate( value, "" ); } catch ( InterpolationException e ) { throw new MojoExecutionException( "Failed to interpolate invoker properties: " + propertiesFile, e ); } props.setProperty( key, value ); } } return new InvokerProperties( props ); } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/GroovyScriptInterpreter.java0000644000175000017500000000611511137101662032467 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 groovy.lang.Binding; import groovy.lang.GroovyShell; import java.io.File; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Iterator; import java.util.List; import java.util.Map; import org.apache.tools.ant.AntClassLoader; import org.codehaus.groovy.control.CompilerConfiguration; /** * Provides a facade to evaluate Groovy scripts. * * @author Benjamin Bentmann * @version $Id: GroovyScriptInterpreter.java 737521 2009-01-25 15:22:26Z bentmann $ */ class GroovyScriptInterpreter implements ScriptInterpreter { /** * {@inheritDoc} */ public Object evaluateScript( String script, List classPath, Map globalVariables, PrintStream scriptOutput ) throws ScriptEvaluationException { PrintStream origOut = System.out; PrintStream origErr = System.err; try { CompilerConfiguration config = new CompilerConfiguration( CompilerConfiguration.DEFAULT ); if ( scriptOutput != null ) { System.setErr( scriptOutput ); System.setOut( scriptOutput ); config.setOutput( new PrintWriter( scriptOutput ) ); } ClassLoader loader = null; if ( classPath != null && !classPath.isEmpty() ) { AntClassLoader childFirstLoader = new AntClassLoader( getClass().getClassLoader(), false ); for ( Iterator it = classPath.iterator(); it.hasNext(); ) { String path = (String) it.next(); childFirstLoader.addPathComponent( new File( path ) ); } loader = childFirstLoader; } Binding binding = new Binding( globalVariables ); GroovyShell interpreter = new GroovyShell( loader, binding, config ); try { return interpreter.evaluate( script ); } catch ( ThreadDeath e ) { throw e; } catch ( Throwable e ) { throw new ScriptEvaluationException( e ); } } finally { System.setErr( origErr ); System.setOut( origOut ); } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/VerifyMojo.java0000644000175000017500000001070211242031713027653 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.invoker.model.io.xpp3.BuildJobXpp3Reader; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import java.io.File; import java.io.IOException; /** * Checks the results of maven-invoker-plugin based integration tests and fails the build if any tests failed. * * @goal verify * @phase verify * @author olamy * @since 1.4 */ public class VerifyMojo extends AbstractMojo { /** * Flag used to suppress certain invocations. This is useful in tailoring the build using profiles. * * @parameter expression="${invoker.skip}" default-value="false" * @since 1.1 */ private boolean skipInvocation; /** * Base directory where all build reports are read from. * * @parameter expression="${invoker.reportsDirectory}" default-value="${project.build.directory}/invoker-reports" * @since 1.4 */ private File reportsDirectory; /** * A flag controlling whether failures of the sub builds should fail the main build, too. If set to * true, the main build will proceed even if one or more sub builds failed. * * @parameter expression="${maven.test.failure.ignore}" default-value="false" * @since 1.3 */ private boolean ignoreFailures; /** * Flag used to suppress the summary output notifying of successes and failures. If set to true, the * only indication of the build's success or failure will be the effect it has on the main build (if it fails, the * main build should fail as well). * * @parameter default-value="false" */ private boolean suppressSummaries; /** * Invokes Maven on the configured test projects. * * @throws org.apache.maven.plugin.MojoExecutionException If the goal encountered severe errors. * @throws org.apache.maven.plugin.MojoFailureException If any of the Maven builds failed. */ public void execute() throws MojoExecutionException, MojoFailureException { if ( skipInvocation ) { getLog().info( "Skipping invocation per configuration." + " If this is incorrect, ensure the skipInvocation parameter is not set to true." ); return; } File[] reportFiles = ReportUtils.getReportFiles( reportsDirectory ); if ( reportFiles.length <= 0 ) { getLog().info( "No invoker report files found, nothing to check." ); return; } InvokerSession invokerSession = new InvokerSession(); for ( int i = 0, size = reportFiles.length; i < size; i++ ) { File reportFile = reportFiles[i]; try { BuildJobXpp3Reader reader = new BuildJobXpp3Reader(); invokerSession.addJob( reader.read( ReaderFactory.newXmlReader( reportFile ) ) ); } catch ( XmlPullParserException e ) { throw new MojoExecutionException( "Failed to parse report file: " + reportFile, e ); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to read report file: " + reportFile, e ); } } if ( !suppressSummaries ) { invokerSession.logSummary( getLog(), ignoreFailures ); } invokerSession.handleFailures( getLog(), ignoreFailures ); } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/MetadataUtils.java0000644000175000017500000001462611252777067030360 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.io.Reader; import java.io.Writer; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Set; import java.util.TimeZone; import org.apache.maven.artifact.Artifact; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.WriterFactory; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.Xpp3DomUtils; import org.codehaus.plexus.util.xml.Xpp3DomWriter; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * Provides utility methods for artifact metadata processing. * * @author Benjamin Bentmann */ class MetadataUtils { /** * Creates local metadata files for the specified artifact. The goal is to simulate the installation of the artifact * by a local build, thereby decoupling the forked builds from the inderministic collection of remote repositories * that are available to the main build and from which the artifact was originally resolved. * * @param file The artifact's file in the local test repository, must not be null. * @param artifact The artifact to create metadata for, must not be null. * @throws IOException If the metadata could not be created. */ public static void createMetadata( File file, Artifact artifact ) throws IOException { TimeZone tz = java.util.TimeZone.getTimeZone( "UTC" ); SimpleDateFormat fmt = new SimpleDateFormat( "yyyyMMddHHmmss" ); fmt.setTimeZone( tz ); String timestamp = fmt.format( new Date() ); if ( artifact.isSnapshot() ) { File metadataFile = new File( file.getParentFile(), "maven-metadata-local.xml" ); Xpp3Dom metadata = new Xpp3Dom( "metadata" ); addChild( metadata, "groupId", artifact.getGroupId() ); addChild( metadata, "artifactId", artifact.getArtifactId() ); addChild( metadata, "version", artifact.getBaseVersion() ); Xpp3Dom versioning = new Xpp3Dom( "versioning" ); versioning.addChild( addChild( new Xpp3Dom( "snapshot" ), "localCopy", "true" ) ); addChild( versioning, "lastUpdated", timestamp ); metadata.addChild( versioning ); writeMetadata( metadataFile, metadata ); } { File metadataFile = new File( file.getParentFile().getParentFile(), "maven-metadata-local.xml" ); Set allVersions = new LinkedHashSet(); Xpp3Dom metadata = readMetadata( metadataFile ); if ( metadata != null ) { Xpp3Dom versioning = metadata.getChild( "versioning" ); if ( versioning != null ) { Xpp3Dom versions = versioning.getChild( "versions" ); if ( versions != null ) { Xpp3Dom[] children = versions.getChildren( "version" ); for ( int i = 0; i < children.length; i++ ) { allVersions.add( children[i].getValue() ); } } } } allVersions.add( artifact.getBaseVersion() ); metadata = new Xpp3Dom( "metadata" ); addChild( metadata, "groupId", artifact.getGroupId() ); addChild( metadata, "artifactId", artifact.getArtifactId() ); Xpp3Dom versioning = new Xpp3Dom( "versioning" ); versioning.addChild( addChildren( new Xpp3Dom( "versions" ), "version", allVersions ) ); addChild( versioning, "lastUpdated", timestamp ); metadata.addChild( versioning ); metadata = Xpp3DomUtils.mergeXpp3Dom( metadata, readMetadata( metadataFile ) ); writeMetadata( metadataFile, metadata ); } } private static Xpp3Dom addChild( Xpp3Dom parent, String childName, String childValue ) { Xpp3Dom child = new Xpp3Dom( childName ); child.setValue( childValue ); parent.addChild( child ); return parent; } private static Xpp3Dom addChildren( Xpp3Dom parent, String childName, Collection childValues ) { for ( Iterator it = childValues.iterator(); it.hasNext(); ) { String childValue = (String) it.next(); addChild( parent, childName, childValue ); } return parent; } private static Xpp3Dom readMetadata( File metadataFile ) throws IOException { if ( !metadataFile.isFile() ) { return null; } Reader reader = ReaderFactory.newXmlReader( metadataFile ); try { try { return Xpp3DomBuilder.build( reader ); } catch ( XmlPullParserException e ) { throw (IOException) new IOException( e.getMessage() ).initCause( e ); } } finally { IOUtil.close( reader ); } } private static void writeMetadata( File metadataFile, Xpp3Dom metadata ) throws IOException { metadataFile.getParentFile().mkdirs(); Writer writer = WriterFactory.newXmlWriter( metadataFile ); try { Xpp3DomWriter.write( writer, metadata ); } finally { IOUtil.close( writer ); } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/SelectorUtils.java0000644000175000017500000001451211267653240030402 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.Os; import org.codehaus.plexus.util.StringUtils; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Properties; /** * Provides utility methods for selecting build jobs based on environmental conditions. * * @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 ( Iterator it = families.iterator(); it.hasNext(); ) { String family = (String) it.next(); 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 boolean isMavenVersion( String mavenSpec ) { List includes = new ArrayList(); List excludes = new ArrayList(); parseList( mavenSpec, includes, excludes ); List mavenVersionList = parseVersion( getMavenVersion() ); return isJreVersion( mavenVersionList, includes, true ) && !isJreVersion( mavenVersionList, excludes, false ); } static boolean isJreVersion( String jreSpec ) { List includes = new ArrayList(); List excludes = new ArrayList(); parseList( jreSpec, includes, excludes ); List jreVersion = parseVersion( System.getProperty( "java.version", "" ) ); return isJreVersion( jreVersion, includes, true ) && !isJreVersion( jreVersion, excludes, false ); } static boolean isJreVersion( List jreVersion, List versionPatterns, boolean defaultMatch ) { if ( versionPatterns != null && !versionPatterns.isEmpty() ) { for ( Iterator it = versionPatterns.iterator(); it.hasNext(); ) { String versionPattern = (String) it.next(); 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 = (Integer) it1.next(); Integer num2 = (Integer) it2.next(); int rel = num1.compareTo( num2 ); if ( rel != 0 ) { return rel; } } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/InvokerSession.java0000644000175000017500000001715611270273205030562 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.invoker.model.BuildJob; import org.apache.maven.plugin.logging.Log; /** * Tracks a set of build jobs and their results. * * @author Benjamin Bentmann */ class InvokerSession { private List buildJobs; private List failedJobs; private List errorJobs; private List successfulJobs; private List skippedJobs; /** * Creates a new empty session. */ public InvokerSession() { buildJobs = new ArrayList(); } /** * Creates a session that initially contains the specified build jobs. * * @param buildJobs The build jobs to set, must not be null. */ public InvokerSession( BuildJob[] buildJobs ) { this.buildJobs = new ArrayList( Arrays.asList( buildJobs ) ); } /** * Adds the specified build job to this session. * * @param buildJob The build job to add, must not be null. */ public void addJob( BuildJob buildJob ) { buildJobs.add( buildJob ); resetStats(); } /** * Sets the build jobs of this session. * * @param buildJobs The build jobs to set, must not be null. */ public void setJobs( List buildJobs ) { this.buildJobs = new ArrayList( buildJobs ); resetStats(); } /** * Gets the build jobs in this session. * * @return The build jobs in this session, can be empty but never null. */ public List getJobs() { return buildJobs; } /** * Gets the successful build jobs in this session. * * @return The successful build jobs in this session, can be empty but never null. */ public List getSuccessfulJobs() { updateStats(); return successfulJobs; } /** * Gets the failed build jobs in this session. * * @return The failed build jobs in this session, can be empty but never null. */ public List getFailedJobs() { updateStats(); return failedJobs; } /** * Gets the build jobs which had errors for this session. * * @return The build jobs in error for this session, can be empty but never null. */ public List getErrorJobs() { updateStats(); return errorJobs; } /** * Gets the skipped build jobs in this session. * * @return The skipped build jobs in this session, can be empty but never null. */ public List getSkippedJobs() { updateStats(); return skippedJobs; } private void resetStats() { successfulJobs = null; failedJobs = null; skippedJobs = null; errorJobs = null; } private void updateStats() { if ( successfulJobs != null && skippedJobs != null && failedJobs != null && errorJobs != null ) { return; } successfulJobs = new ArrayList(); failedJobs = new ArrayList(); skippedJobs = new ArrayList(); errorJobs = new ArrayList(); for ( Iterator iterator = buildJobs.iterator(); iterator.hasNext(); ) { BuildJob buildJob = (BuildJob) iterator.next(); if ( BuildJob.Result.SUCCESS.equals( buildJob.getResult() ) ) { successfulJobs.add( buildJob ); } else if ( BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) ) { skippedJobs.add( buildJob ); } else if ( BuildJob.Result.ERROR.equals( buildJob.getResult() ) ) { errorJobs.add( buildJob ); } else if ( buildJob.getResult() != null ) { failedJobs.add( buildJob ); } } } /** * Prints a summary of this session to the specified logger. * * @param logger The mojo logger to output messages to, must not be null. * @param ignoreFailures A flag whether failures should be ignored or whether a build failure should be signaled. */ public void logSummary( Log logger, boolean ignoreFailures ) { updateStats(); String separator = "-------------------------------------------------"; logger.info( separator ); logger.info( "Build Summary:" ); logger.info( " Passed: " + successfulJobs.size() + ", Failed: " + failedJobs.size() + ", Errors: " + errorJobs.size() + ", Skipped: " + skippedJobs.size() ); logger.info( separator ); if ( !failedJobs.isEmpty() ) { String heading = "The following builds failed:"; if ( ignoreFailures ) { logger.warn( heading ); } else { logger.error( heading ); } for ( Iterator it = failedJobs.iterator(); it.hasNext(); ) { BuildJob buildJob = (BuildJob) it.next(); String item = "* " + buildJob.getProject(); if ( ignoreFailures ) { logger.warn( item ); } else { logger.error( item ); } } logger.info( separator ); } } /** * Handles the build failures in this session. * * @param logger The mojo logger to output messages to, must not be null. * @param ignoreFailures A flag whether failures should be ignored or whether a build failure should be signaled. * @throws MojoFailureException If failures are present and not ignored. */ public void handleFailures( Log logger, boolean ignoreFailures ) throws MojoFailureException { updateStats(); if ( !failedJobs.isEmpty() ) { String message = failedJobs.size() + " build" + ( failedJobs.size() == 1 ? "" : "s" ) + " failed."; if ( ignoreFailures ) { logger.warn( "Ignoring that " + message ); } else { throw new MojoFailureException( this, message, message ); } } if ( !errorJobs.isEmpty() ) { String message = errorJobs.size() + " build" + ( errorJobs.size() == 1 ? "" : "s" ) + " in error."; if ( ignoreFailures ) { logger.warn( "Ignoring that " + message ); } else { throw new MojoFailureException( this, message, message ); } } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/InstallMojo.java0000644000175000017500000005364111252777067030052 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; import org.apache.maven.artifact.installer.ArtifactInstaller; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryFactory; import org.apache.maven.model.Model; import org.apache.maven.model.Parent; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; /** * Installs the project artifacts of the main build into the local repository as a preparation to run the sub projects. * More precisely, all artifacts of the project itself, all its locally reachable parent POMs and all its dependencies * from the reactor will be installed to the local repository. * * @goal install * @phase pre-integration-test * @requiresDependencyResolution runtime * @since 1.2 * @author Paul Gier * @author Benjamin Bentmann * @version $Id: InstallMojo.java 814226 2009-09-12 20:01:59Z bentmann $ */ public class InstallMojo extends AbstractMojo { /** * Maven artifact install component to copy artifacts to the local repository. * * @component */ private ArtifactInstaller installer; /** * The component used to create artifacts. * * @component */ private ArtifactFactory artifactFactory; /** * The component used to create artifacts. * * @component */ private ArtifactRepositoryFactory repositoryFactory; /** * @parameter expression="${localRepository}" * @required * @readonly */ private ArtifactRepository localRepository; /** * The path to the local repository into which the project artifacts should be installed for the integration tests. * If not set, the regular local repository will be used. To prevent soiling of your regular local repository with * possibly broken artifacts, it is strongly recommended to use an isolated repository for the integration tests * (e.g. ${project.build.directory}/it-repo). * * @parameter expression="${invoker.localRepositoryPath}" */ private File localRepositoryPath; /** * The current Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * The set of Maven projects in the reactor build. * * @parameter default-value="${reactorProjects}" * @readonly */ private Collection reactorProjects; /** * A flag used to disable the installation procedure. This is primarily intended for usage from the command line to * occasionally adjust the build. * * @parameter expression="${invoker.skip}" default-value="false" * @since 1.4 */ private boolean skipInstallation; /** * The identifiers of already installed artifacts, used to avoid multiple installation of the same artifact. */ private Collection installedArtifacts; /** * The identifiers of already copied artifacts, used to avoid multiple installation of the same artifact. */ private Collection copiedArtifacts; /** * Performs this mojo's tasks. * * @throws MojoExecutionException If the artifacts could not be installed. */ public void execute() throws MojoExecutionException { if ( skipInstallation ) { getLog().info( "Skipping artifact installation per configuration." ); return; } ArtifactRepository testRepository = createTestRepository(); installedArtifacts = new HashSet(); copiedArtifacts = new HashSet(); installProjectDependencies( project, reactorProjects, testRepository ); installProjectParents( project, testRepository ); installProjectArtifacts( project, testRepository ); } /** * Creates the local repository for the integration tests. If the user specified a custom repository location, the * custom repository will have the same identifier, layout and policies as the real local repository. That means * apart from the location, the custom repository will be indistinguishable from the real repository such that its * usage is transparent to the integration tests. * * @return The local repository for the integration tests, never null. * @throws MojoExecutionException If the repository could not be created. */ private ArtifactRepository createTestRepository() throws MojoExecutionException { ArtifactRepository testRepository = localRepository; if ( localRepositoryPath != null ) { try { if ( !localRepositoryPath.exists() && !localRepositoryPath.mkdirs() ) { throw new IOException( "Failed to create directory: " + localRepositoryPath ); } testRepository = repositoryFactory.createArtifactRepository( localRepository.getId(), localRepositoryPath.toURL().toExternalForm(), localRepository.getLayout(), localRepository.getSnapshots(), localRepository.getReleases() ); } catch ( Exception e ) { throw new MojoExecutionException( "Failed to create local repository: " + localRepositoryPath, e ); } } return testRepository; } /** * Installs the specified artifact to the local repository. Note: This method should only be used for artifacts that * originate from the current (reactor) build. Artifacts that have been grabbed from the user's local repository * should be installed to the test repository via {@link #copyArtifact(File, Artifact, ArtifactRepository)}. * * @param file The file associated with the artifact, must not be null. This is in most cases the value * of artifact.getFile() with the exception of the main artifact from a project with * packaging "pom". Projects with packaging "pom" have no main artifact file. They have however artifact * metadata (e.g. site descriptors) which needs to be installed. * @param artifact The artifact to install, must not be null. * @param testRepository The local repository to install the artifact to, must not be null. * @throws MojoExecutionException If the artifact could not be installed (e.g. has no associated file). */ private void installArtifact( File file, Artifact artifact, ArtifactRepository testRepository ) throws MojoExecutionException { try { if ( file == null ) { throw new IllegalStateException( "Artifact has no associated file: " + file ); } if ( !file.isFile() ) { throw new IllegalStateException( "Artifact is not fully assembled: " + file ); } if ( installedArtifacts.add( artifact.getId() ) ) { installer.install( file, artifact, testRepository ); } else { getLog().debug( "Not re-installing " + artifact + ", " + file ); } } catch ( Exception e ) { throw new MojoExecutionException( "Failed to install artifact: " + artifact, e ); } } /** * Installs the specified artifact to the local repository. This method serves basically the same purpose as * {@link #installArtifact(File, Artifact, ArtifactRepository)} but is meant for artifacts that have been resolved * from the user's local repository (and not the current build outputs). The subtle difference here is that * artifacts from the repository have already undergone transformations and these manipulations should not be redone * by the artifact installer. For this reason, this method performs plain copy operations to install the artifacts. * * @param file The file associated with the artifact, must not be null. * @param artifact The artifact to install, must not be null. * @param testRepository The local repository to install the artifact to, must not be null. * @throws MojoExecutionException If the artifact could not be installed (e.g. has no associated file). */ private void copyArtifact( File file, Artifact artifact, ArtifactRepository testRepository ) throws MojoExecutionException { try { if ( file == null ) { throw new IllegalStateException( "Artifact has no associated file: " + file ); } if ( !file.isFile() ) { throw new IllegalStateException( "Artifact is not fully assembled: " + file ); } if ( copiedArtifacts.add( artifact.getId() ) ) { File destination = new File( testRepository.getBasedir(), testRepository.pathOf( artifact ) ); getLog().debug( "Installing " + file + " to " + destination ); copyFileIfDifferent( file, destination ); MetadataUtils.createMetadata( destination, artifact ); } else { getLog().debug( "Not re-installing " + artifact + ", " + file ); } } catch ( Exception e ) { throw new MojoExecutionException( "Failed to stage artifact: " + artifact, e ); } } private void copyFileIfDifferent( File src, File dst ) throws IOException { if ( src.lastModified() != dst.lastModified() || src.length() != dst.length() ) { FileUtils.copyFile( src, dst ); dst.setLastModified( src.lastModified() ); } } /** * Installs the main artifact and any attached artifacts of the specified project to the local repository. * * @param mvnProject The project whose artifacts should be installed, must not be null. * @param testRepository The local repository to install the artifacts to, must not be null. * @throws MojoExecutionException If any artifact could not be installed. */ private void installProjectArtifacts( MavenProject mvnProject, ArtifactRepository testRepository ) throws MojoExecutionException { try { // Install POM (usually attached as metadata but that happens only as a side effect of the Install Plugin) installProjectPom( mvnProject, testRepository ); // Install the main project artifact (if the project has one, e.g. has no "pom" packaging) Artifact mainArtifact = mvnProject.getArtifact(); if ( mainArtifact.getFile() != null ) { installArtifact( mainArtifact.getFile(), mainArtifact, testRepository ); } // Install any attached project artifacts Collection attachedArtifacts = mvnProject.getAttachedArtifacts(); for ( Iterator artifactIter = attachedArtifacts.iterator(); artifactIter.hasNext(); ) { Artifact attachedArtifact = (Artifact) artifactIter.next(); installArtifact( attachedArtifact.getFile(), attachedArtifact, testRepository ); } } catch ( Exception e ) { throw new MojoExecutionException( "Failed to install project artifacts: " + mvnProject, e ); } } /** * Installs the (locally reachable) parent POMs of the specified project to the local repository. The parent POMs * from the reactor must be installed or the forked IT builds will fail when using a clean repository. * * @param mvnProject The project whose parent POMs should be installed, must not be null. * @param testRepository The local repository to install the POMs to, must not be null. * @throws MojoExecutionException If any POM could not be installed. */ private void installProjectParents( MavenProject mvnProject, ArtifactRepository testRepository ) throws MojoExecutionException { try { for ( MavenProject parent = mvnProject.getParent(); parent != null; parent = parent.getParent() ) { if ( parent.getFile() == null ) { copyParentPoms( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), testRepository ); break; } installProjectPom( parent, testRepository ); } } catch ( Exception e ) { throw new MojoExecutionException( "Failed to install project parents: " + mvnProject, e ); } } /** * Installs the POM of the specified project to the local repository. * * @param mvnProject The project whose POM should be installed, must not be null. * @param testRepository The local repository to install the POM to, must not be null. * @throws MojoExecutionException If the POM could not be installed. */ private void installProjectPom( MavenProject mvnProject, ArtifactRepository testRepository ) throws MojoExecutionException { try { Artifact pomArtifact = null; if ( "pom".equals( mvnProject.getPackaging() ) ) { pomArtifact = mvnProject.getArtifact(); } if ( pomArtifact == null ) { pomArtifact = artifactFactory.createProjectArtifact( mvnProject.getGroupId(), mvnProject.getArtifactId(), mvnProject.getVersion() ); } installArtifact( mvnProject.getFile(), pomArtifact, testRepository ); } catch ( Exception e ) { throw new MojoExecutionException( "Failed to install POM: " + mvnProject, e ); } } /** * Installs the dependent projects from the reactor to the local repository. The dependencies on other modules from * the reactor must be installed or the forked IT builds will fail when using a clean repository. * * @param mvnProject The project whose dependent projects should be installed, must not be null. * @param reactorProjects The set of projects in the reactor build, must not be null. * @param testRepository The local repository to install the POMs to, must not be null. * @throws MojoExecutionException If any dependency could not be installed. */ private void installProjectDependencies( MavenProject mvnProject, Collection reactorProjects, ArtifactRepository testRepository ) throws MojoExecutionException { // index available reactor projects Map projects = new HashMap(); for ( Iterator it = reactorProjects.iterator(); it.hasNext(); ) { MavenProject reactorProject = (MavenProject) it.next(); String projectId = reactorProject.getGroupId() + ':' + reactorProject.getArtifactId() + ':' + reactorProject.getVersion(); projects.put( projectId, reactorProject ); } // group transitive dependencies (even those that don't contribute to the class path like POMs) ... Collection artifacts = mvnProject.getArtifacts(); // ... into dependencies that were resolved from reactor projects ... Collection dependencyProjects = new LinkedHashSet(); // ... and those that were resolved from the (local) repo Collection dependencyArtifacts = new LinkedHashSet(); for ( Iterator it = artifacts.iterator(); it.hasNext(); ) { Artifact artifact = (Artifact) it.next(); // workaround for MNG-2961 to ensure the base version does not contain a timestamp artifact.isSnapshot(); String projectId = artifact.getGroupId() + ':' + artifact.getArtifactId() + ':' + artifact.getBaseVersion(); if ( projects.containsKey( projectId ) ) { dependencyProjects.add( projectId ); } else { dependencyArtifacts.add( artifact ); } } // install dependencies try { // copy dependencies that where resolved from the local repo for ( Iterator it = dependencyArtifacts.iterator(); it.hasNext(); ) { Artifact artifact = (Artifact) it.next(); Artifact depArtifact = artifactFactory.createArtifactWithClassifier( artifact.getGroupId(), artifact.getArtifactId(), artifact.getBaseVersion(), artifact.getType(), artifact.getClassifier() ); File artifactFile = artifact.getFile(); Artifact pomArtifact = artifactFactory.createProjectArtifact( depArtifact.getGroupId(), depArtifact.getArtifactId(), depArtifact.getBaseVersion() ); File pomFile = new File( localRepository.getBasedir(), localRepository.pathOf( pomArtifact ) ); if ( pomFile.isFile() ) { if ( !pomArtifact.getId().equals( depArtifact.getId() ) ) { copyArtifact( pomFile, pomArtifact, testRepository ); } copyParentPoms( pomFile, testRepository ); } copyArtifact( artifactFile, depArtifact, testRepository ); } // install dependencies that were resolved from the reactor for ( Iterator it = dependencyProjects.iterator(); it.hasNext(); ) { String projectId = (String) it.next(); MavenProject dependencyProject = (MavenProject) projects.get( projectId ); installProjectArtifacts( dependencyProject, testRepository ); installProjectParents( dependencyProject, testRepository ); } } catch ( Exception e ) { throw new MojoExecutionException( "Failed to install project dependencies: " + mvnProject, e ); } } /** * Installs all parent POMs of the specified POM file that are available in the local repository. * * @param pomFile The path to the POM file whose parents should be installed, must not be null. * @param testRepository The local repository to install the POMs to, must not be null. * @throws MojoExecutionException If any (existing) parent POM could not be installed. */ private void copyParentPoms( File pomFile, ArtifactRepository testRepository ) throws MojoExecutionException { Model model = PomUtils.loadPom( pomFile ); Parent parent = model.getParent(); if ( parent != null ) { copyParentPoms( parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), testRepository ); } } /** * Installs the specified POM and all its parent POMs to the local repository. * * @param groupId The group id of the POM which should be installed, must not be null. * @param artifactId The artifact id of the POM which should be installed, must not be null. * @param version The version of the POM which should be installed, must not be null. * @param testRepository The local repository to install the POMs to, must not be null. * @throws MojoExecutionException If any (existing) parent POM could not be installed. */ private void copyParentPoms( String groupId, String artifactId, String version, ArtifactRepository testRepository ) throws MojoExecutionException { Artifact pomArtifact = artifactFactory.createProjectArtifact( groupId, artifactId, version ); if ( installedArtifacts.contains( pomArtifact.getId() ) || copiedArtifacts.contains( pomArtifact.getId() ) ) { getLog().debug( "Not re-installing " + pomArtifact ); return; } File pomFile = new File( localRepository.getBasedir(), localRepository.pathOf( pomArtifact ) ); if ( pomFile.isFile() ) { copyArtifact( pomFile, pomArtifact, testRepository ); copyParentPoms( pomFile, testRepository ); } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/BuildFailureException.java0000644000175000017500000000407411140143601032012 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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. */ /** * Signals a failure of a sub build run by the Invoker Plugin. This can be caused by an unsuccessful pre-/post-build * script or a failure of the forked Maven build itself. * * @author Benjamin Bentmann * @version $Id: BuildFailureException.java 738621 2009-01-28 21:00:49Z bentmann $ */ class BuildFailureException extends Exception { /** * The serial version identifier for this class. */ private static final long serialVersionUID = 236131530635863815L; /** * The type of the build failure. */ private final String type; /** * Creates a new exception with the specified detail message. * * @param message The detail message, may be null. * @param type The type of build failure, may not be null. */ public BuildFailureException( String message, String type ) { super( message ); if ( type == null ) { throw new IllegalArgumentException( "missing failure type" ); } this.type = type; } /** * Returns the type of build failure. * * @return The type of build failure, never null. */ public String getType() { return type; } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/IntegrationTestMojo.java0000644000175000017500000000305111242031713031531 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.plugin.MojoFailureException; /** * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, will * never fail the build, designed to be used in conjunction with the verify mojo. * * @goal integration-test * @phase integration-test * @requiresDependencyResolution test * @since 1.4 * * @author Stephen Connolly * @version $Id: IntegrationTestMojo.java 804712 2009-08-16 16:28:59Z bentmann $ */ public class IntegrationTestMojo extends AbstractInvokerMojo { void processResults( InvokerSession invokerSession ) throws MojoFailureException { // do nothing } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/InvokerReport.java0000644000175000017500000002605011255413576030415 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Locale; import org.apache.maven.doxia.sink.Sink; import org.apache.maven.doxia.siterenderer.Renderer; import org.apache.maven.plugin.invoker.model.BuildJob; import org.apache.maven.plugin.invoker.model.io.xpp3.BuildJobXpp3Reader; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.i18n.I18N; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * Generate a report based on the results of the Maven invocations. Note: This mojo doesn't fork any * lifecycle, if you have a clean working copy, you have to use a command like * mvn clean integration-test site to ensure the build results are present when this goal is invoked. * * @goal report * @author olamy * @since 1.4 */ public class InvokerReport extends AbstractMavenReport { /** * The Maven Project. * * @parameter default-value="${project}" * @required * @readonly */ protected MavenProject project; /** * Doxia Site Renderer component. * * @component */ protected Renderer siteRenderer; /** * Internationalization component. * * @component */ protected I18N i18n; /** * The output directory for the report. Note that this parameter is only evaluated if the goal is run directly from * the command line. If the goal is run indirectly as part of a site generation, the output directory configured in * the Maven Site Plugin is used instead. * * @parameter default-value="${project.reporting.outputDirectory}" * @required */ protected File outputDirectory; /** * Base directory where all build reports have been written to. * * @parameter expression="${invoker.reportsDirectory}" default-value="${project.build.directory}/invoker-reports" */ private File reportsDirectory; /** * The number format used to print percent values in the report locale. */ private NumberFormat percentFormat; /** * The number format used to print time values in the report locale. */ private NumberFormat secondsFormat; protected void executeReport( Locale locale ) throws MavenReportException { DecimalFormatSymbols symbols = new DecimalFormatSymbols( locale ); percentFormat = new DecimalFormat( getText( locale, "report.invoker.format.percent" ), symbols ); secondsFormat = new DecimalFormat( getText( locale, "report.invoker.format.seconds" ), symbols ); Sink sink = getSink(); sink.head(); sink.title(); sink.text( getText( locale, "report.invoker.result.title" ) ); sink.title_(); sink.head_(); sink.body(); sink.section1(); sink.sectionTitle1(); sink.text( getText( locale, "report.invoker.result.title" ) ); sink.sectionTitle1_(); sink.paragraph(); sink.text( getText( locale, "report.invoker.result.description" ) ); sink.paragraph_(); sink.section1_(); // ---------------------------------- // build buildJob beans // ---------------------------------- File[] reportFiles = ReportUtils.getReportFiles( reportsDirectory ); if ( reportFiles.length <= 0 ) { getLog().info( "no invoker report files found, skip report generation" ); return; } List buildJobs = new ArrayList( reportFiles.length ); for ( int i = 0, size = reportFiles.length; i < size; i++ ) { File reportFile = reportFiles[i]; try { BuildJobXpp3Reader reader = new BuildJobXpp3Reader(); buildJobs.add( reader.read( ReaderFactory.newXmlReader( reportFile ) ) ); } catch ( XmlPullParserException e ) { throw new MavenReportException( "Failed to parse report file: " + reportFile, e ); } catch ( IOException e ) { throw new MavenReportException( "Failed to read report file: " + reportFile, e ); } } // ---------------------------------- // summary // ---------------------------------- constructSummarySection( buildJobs, locale ); // ---------------------------------- // per file/it detail // ---------------------------------- sink.section2(); sink.sectionTitle2(); sink.text( getText( locale, "report.invoker.detail.title" ) ); sink.sectionTitle2_(); sink.section2_(); // detail tests table header sink.table(); sink.tableRow(); // ------------------------------------------- // name | Result | time | message // ------------------------------------------- sinkTableHeader( sink, getText( locale, "report.invoker.detail.name" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.detail.result" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.detail.time" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.detail.message" ) ); sink.tableRow_(); for ( Iterator iterator = buildJobs.iterator(); iterator.hasNext(); ) { BuildJob buildJob = (BuildJob) iterator.next(); renderBuildJob( buildJob, locale ); } sink.table_(); sink.body_(); sink.flush(); sink.close(); } private void constructSummarySection( List /* BuildJob */buildJobs, Locale locale ) { Sink sink = getSink(); sink.section2(); sink.sectionTitle2(); sink.text( getText( locale, "report.invoker.summary.title" ) ); sink.sectionTitle2_(); sink.section2_(); // ------------------------------------------------------------------------ // Building a table with // it number | succes nb | failed nb | Success rate | total time | avg time // ------------------------------------------------------------------------ sink.table(); sink.tableRow(); sinkTableHeader( sink, getText( locale, "report.invoker.summary.number" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.summary.success" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.summary.failed" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.summary.success.rate" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.total" ) ); sinkTableHeader( sink, getText( locale, "report.invoker.summary.time.avg" ) ); int number = buildJobs.size(); int success = 0; int failed = 0; double totalTime = 0; for ( Iterator iterator = buildJobs.iterator(); iterator.hasNext(); ) { BuildJob buildJob = (BuildJob) iterator.next(); if ( BuildJob.Result.SUCCESS.equals( buildJob.getResult() ) ) { success++; } else if ( !BuildJob.Result.SKIPPED.equals( buildJob.getResult() ) ) { failed++; } totalTime += buildJob.getTime(); } sink.tableRow_(); sink.tableRow(); sinkCell( sink, Integer.toString( number ) ); sinkCell( sink, Integer.toString( success ) ); sinkCell( sink, Integer.toString( failed ) ); if ( success + failed > 0 ) { sinkCell( sink, percentFormat.format( (double) success / ( success + failed ) ) ); } else { sinkCell( sink, "" ); } sinkCell( sink, secondsFormat.format( totalTime ) ); sinkCell( sink, secondsFormat.format( totalTime / number ) ); sink.tableRow_(); sink.table_(); } private void renderBuildJob( BuildJob buildJob, Locale locale ) { Sink sink = getSink(); sink.tableRow(); StringBuffer buffer = new StringBuffer(); if ( !StringUtils.isEmpty( buildJob.getName() ) && !StringUtils.isEmpty( buildJob.getDescription() ) ) { buffer.append( buildJob.getName() ); buffer.append( " : " ); buffer.append( buildJob.getDescription() ); } else { buffer.append( buildJob.getProject() ); } sinkCell( sink, buffer.toString() ); // FIXME image sinkCell( sink, buildJob.getResult() ); sinkCell( sink, secondsFormat.format( buildJob.getTime() ) ); sinkCell( sink, buildJob.getFailureMessage() ); sink.tableRow_(); } protected String getOutputDirectory() { return outputDirectory.getAbsolutePath(); } protected MavenProject getProject() { return project; } protected Renderer getSiteRenderer() { return siteRenderer; } public String getDescription( Locale locale ) { return getText( locale, "report.invoker.result.description" ); } public String getName( Locale locale ) { return getText( locale, "report.invoker.result.name" ); } public String getOutputName() { return "invoker-report"; } public boolean canGenerateReport() { return ReportUtils.getReportFiles( reportsDirectory ).length > 0; } private String getText( Locale locale, String key ) { return i18n.getString( "invoker-report", locale, key ); } private void sinkTableHeader( Sink sink, String header ) { sink.tableHeaderCell(); sink.text( header ); sink.tableHeaderCell_(); } private void sinkCell( Sink sink, String text ) { sink.tableCell(); sink.text( text ); sink.tableCell_(); } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/ReportUtils.java0000644000175000017500000000311111242031713030052 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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; /** * Provides utility methods for invoker report processing. * * @author Benjamin Bentmann */ class ReportUtils { /** * Gets the paths to the invoker reports available in the specified directory. * *@param reportsDirectory The base directory where the invoker reports are located in, may be null. * @return The paths to the invoker reports, can be empty but never null. */ public static File[] getReportFiles( File reportsDirectory ) { File[] reportFiles = ( reportsDirectory != null ) ? reportsDirectory.listFiles() : null; if ( reportFiles == null ) { reportFiles = new File[0]; } return reportFiles; } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/ScriptRunner.java0000644000175000017500000002465511267526125030251 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.io.PrintStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.StringUtils; /** * Runs pre-/post-build hook scripts. * * @author Benjamin Bentmann * @version $Id: ScriptRunner.java 827900 2009-10-21 06:38:13Z stephenc $ */ class ScriptRunner { /** * The mojo logger to print diagnostic to, never null. */ private Log log; /** * The supported script interpreters, indexed by the lower-case file extension of their associated script files, * never null. */ private Map scriptInterpreters; /** * The common set of global variables to pass into the script interpreter, never null. */ private Map globalVariables; /** * The additional class path for the script interpreter, never null. */ private List classPath; /** * The file encoding of the hook scripts or null to use platform encoding. */ private String encoding; /** * Creates a new script runner. * * @param log The mojo logger to print diagnostic to, must not be null. */ public ScriptRunner( Log log ) { if ( log == null ) { throw new IllegalArgumentException( "missing logger" ); } this.log = log; scriptInterpreters = new LinkedHashMap(); scriptInterpreters.put( "bsh", new BeanShellScriptInterpreter() ); scriptInterpreters.put( "groovy", new GroovyScriptInterpreter() ); globalVariables = new HashMap(); classPath = new ArrayList(); } /** * Gets the mojo logger. * * @return The mojo logger, never null. */ private Log getLog() { return log; } /** * Sets a global variable for the script interpeter. * * @param name The name of the variable, must not be null. * @param value The value of the variable, may be null. */ public void setGlobalVariable( String name, Object value ) { this.globalVariables.put( name, value ); } /** * Sets the additional class path for the hook scripts. Note that the provided list is copied, so any later changes * will not affect the scripts. * * @param classPath The additional class path for the script interpreter, may be null or empty if only * the plugin realm should be used for the script evaluation. If specified, this class path will precede * the artifacts from the plugin class path. */ public void setClassPath( List classPath ) { this.classPath = ( classPath != null ) ? new ArrayList( classPath ) : new ArrayList(); } /** * Sets the file encoding of the hook scripts. * * @param encoding The file encoding of the hook scripts, may be null or empty to use the platform's * default encoding. */ public void setScriptEncoding( String encoding ) { this.encoding = StringUtils.isNotEmpty( encoding ) ? encoding : null; } /** * Runs the specified hook script of the specified project (if any). * * @param scriptDescription The description of the script to use for logging, must not be null. * @param basedir The base directory of the project, must not be null. * @param relativeScriptPath The path to the script relative to the project base directory, may be null * to skip the script execution. * @param context The key-value storage used to share information between hook scripts, may be null. * @param logger The logger to redirect the script output to, may be null to use stdout/stderr. * @param stage The stage of the build job the script is invoked in, must not be null. * @param failOnException If true and the script throws an exception, then a {@link BuildFailureException} * will be thrown, otherwise a {@link BuildErrorException} will be thrown on script exception. * @throws MojoExecutionException If an I/O error occurred while reading the script file. * @throws BuildFailureException If the script did not return true of threw an exception. */ public void run( final String scriptDescription, final File basedir, final String relativeScriptPath, final Map context, final FileLogger logger, String stage, boolean failOnException ) throws MojoExecutionException, BuildFailureException { if ( relativeScriptPath == null ) { return; } final File scriptFile = resolveScript( new File( basedir, relativeScriptPath ) ); if ( !scriptFile.exists() ) { return; } Map globalVariables = new HashMap( this.globalVariables ); globalVariables.put( "basedir", basedir ); globalVariables.put( "context", context ); PrintStream out = ( logger != null ) ? logger.getPrintStream() : null; ScriptInterpreter interpreter = getInterpreter( scriptFile ); if ( getLog().isDebugEnabled() ) { String name = interpreter.getClass().getName(); name = name.substring( name.lastIndexOf( '.' ) + 1 ); getLog().debug( "Running script with " + name + ": " + scriptFile ); } String script; try { script = FileUtils.fileRead( scriptFile, encoding ); } catch ( IOException e ) { String errorMessage = "error reading " + scriptDescription + " " + scriptFile.getPath() + ", " + e.getMessage(); throw new MojoExecutionException( errorMessage, e ); } Object result; try { if ( logger != null ) { logger.consumeLine( "Running " + scriptDescription + ": " + scriptFile ); } result = interpreter.evaluateScript( script, classPath, globalVariables, out ); if ( logger != null ) { logger.consumeLine( "Finished " + scriptDescription + ": " + scriptFile ); } } catch ( ScriptEvaluationException e ) { Throwable t = ( e.getCause() != null ) ? e.getCause() : e; String msg = ( t.getMessage() != null ) ? t.getMessage() : t.toString(); if ( getLog().isDebugEnabled() ) { String errorMessage = "Error evaluating " + scriptDescription + " " + scriptFile.getPath() + ", " + t; getLog().debug( errorMessage, t ); } if ( logger != null ) { t.printStackTrace( logger.getPrintStream() ); } if ( failOnException ) { throw new BuildFailureException( "The " + scriptDescription + " did not succeed. " + msg, stage ); } else { throw new BuildErrorException( "The " + scriptDescription + " did not succeed. " + msg, stage, t ); } } if ( !( result == null || Boolean.TRUE.equals( result ) || "true".equals( result ) ) ) { throw new BuildFailureException( "The " + scriptDescription + " returned " + result + ".", stage ); } } /** * Gets the effective path to the specified script. For convenience, we allow to specify a script path as "verify" * and have the plugin auto-append the file extension to search for "verify.bsh" and "verify.groovy". * * @param scriptFile The script file to resolve, may be null. * @return The effective path to the script file or null if the input was null. */ private File resolveScript( File scriptFile ) { if ( scriptFile != null && !scriptFile.exists() ) { for ( Iterator it = this.scriptInterpreters.keySet().iterator(); it.hasNext(); ) { String ext = (String) it.next(); File candidateFile = new File( scriptFile.getPath() + '.' + ext ); if ( candidateFile.exists() ) { scriptFile = candidateFile; break; } } } return scriptFile; } /** * Determines the script interpreter for the specified script file by looking at its file extension. In this * context, file extensions are considered case-insensitive. For backward compatibility with plugin versions 1.2-, * the BeanShell interpreter will be used for any unrecognized extension. * * @param scriptFile The script file for which to determine an interpreter, must not be null. * @return The script interpreter for the file, never null. */ private ScriptInterpreter getInterpreter( File scriptFile ) { String ext = FileUtils.extension( scriptFile.getName() ).toLowerCase( Locale.ENGLISH ); ScriptInterpreter interpreter = (ScriptInterpreter) scriptInterpreters.get( ext ); if ( interpreter == null ) { interpreter = (ScriptInterpreter) scriptInterpreters.get( "bsh" ); } return interpreter; } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java0000644000175000017500000000405111242031713030024 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.plugin.MojoFailureException; /** * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and * outputting the results to the command line. * * @goal run * @phase integration-test * @requiresDependencyResolution test * @since 1.0 * * @author Kenney Westerhof * @author John Casey * @version $Id: InvokerMojo.java 804712 2009-08-16 16:28:59Z bentmann $ */ public class InvokerMojo extends AbstractInvokerMojo { /** * A flag controlling whether failures of the sub builds should fail the main build, too. If set to * true, the main build will proceed even if one or more sub builds failed. * * @parameter expression="${maven.test.failure.ignore}" default-value="false" * @since 1.3 */ private boolean ignoreFailures; void processResults( InvokerSession invokerSession ) throws MojoFailureException { if ( !suppressSummaries ) { invokerSession.logSummary( getLog(), ignoreFailures ); } invokerSession.handleFailures( getLog(), ignoreFailures ); } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/BuildErrorException.java0000644000175000017500000000340311267406352031526 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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. */ /** * Signals an error in a sub build run by the Invoker Plugin. This can be caused by a selector/pre-build * script throwing an exception or an error in forking the Maven build itself. * * @author Stephen Connolly * @version $Id: BuildErrorException.java 827765 2009-10-20 19:18:02Z stephenc $ */ class BuildErrorException extends BuildFailureException { /** * The serial version identifier for this class. */ private static final long serialVersionUID = 236131530635863815L; /** * Creates a new exception with the specified detail message. * * @param message The detail message, may be null. * @param type The type of build failure, may not be null. * @param cause The cause of the build error. */ public BuildErrorException( String message, String type, Throwable cause ) { super( message, type ); initCause( cause ); } } ././@LongLink0000000000000000000000000000014600000000000011566 Lustar rootrootmaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/ScriptEvaluationException.javamaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/ScriptEvaluationException.jav0000644000175000017500000000305211047613663032611 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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. */ /** * Signals an error during parsing/evaluation of a script. This can either be a syntax error in the script itself or an * exception triggered by the methods it invoked. * * @author Benjamin Bentmann * @version $Id: ScriptEvaluationException.java 684549 2008-08-10 16:30:43Z bentmann $ */ class ScriptEvaluationException extends Exception { /** * The serial version identifier for this class. */ private static final long serialVersionUID = 199336743291078393L; /** * Creates a new exception with the specified cause. * * @param cause The cause, may be null. */ public ScriptEvaluationException( Throwable cause ) { super( cause ); } } ././@LongLink0000000000000000000000000000014700000000000011567 Lustar rootrootmaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreter.javamaven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/BeanShellScriptInterpreter.ja0000644000175000017500000001004011137101662032500 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.io.PrintStream; import java.util.Iterator; import java.util.List; import java.util.Map; import bsh.Capabilities; import bsh.EvalError; import bsh.Interpreter; import bsh.TargetError; /** * Provides a facade to evaluate BeanShell scripts. * * @author Benjamin Bentmann * @version $Id: BeanShellScriptInterpreter.java 737521 2009-01-25 15:22:26Z bentmann $ */ class BeanShellScriptInterpreter implements ScriptInterpreter { /** * {@inheritDoc} */ public Object evaluateScript( String script, List classPath, Map globalVariables, PrintStream scriptOutput ) throws ScriptEvaluationException { PrintStream origOut = System.out; PrintStream origErr = System.err; try { Interpreter engine = new Interpreter(); if ( scriptOutput != null ) { System.setErr( scriptOutput ); System.setOut( scriptOutput ); engine.setErr( scriptOutput ); engine.setOut( scriptOutput ); } if ( !Capabilities.haveAccessibility() ) { try { Capabilities.setAccessibility( true ); } catch ( Exception e ) { if ( scriptOutput != null ) { e.printStackTrace( scriptOutput ); } } } if ( classPath != null && !classPath.isEmpty() ) { for ( Iterator it = classPath.iterator(); it.hasNext(); ) { String path = (String) it.next(); try { engine.getClassManager().addClassPath( new File( path ).toURI().toURL() ); } catch ( IOException e ) { throw new RuntimeException( "bad class path: " + path, e ); } } } if ( globalVariables != null ) { for ( Iterator it = globalVariables.keySet().iterator(); it.hasNext(); ) { String variable = (String) it.next(); Object value = globalVariables.get( variable ); try { engine.set( variable, value ); } catch ( EvalError e ) { throw new RuntimeException( e ); } } } try { return engine.eval( script ); } catch ( TargetError e ) { throw new ScriptEvaluationException( e.getTarget() ); } catch ( ThreadDeath e ) { throw e; } catch ( Throwable e ) { throw new ScriptEvaluationException( e ); } } finally { System.setErr( origErr ); System.setOut( origOut ); } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/ScriptInterpreter.java0000644000175000017500000000444511047613663031276 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.PrintStream; import java.util.List; import java.util.Map; /** * Defines a simple abstraction used to plug-in several script interpreters for the pre-/post-build-hooks. Each * interpretator implementation should be stateless and support reuse. * * @author Benjamin Bentmann * @version $Id: ScriptInterpreter.java 684549 2008-08-10 16:30:43Z bentmann $ */ interface ScriptInterpreter { /** * Evaluates the specified script. * * @param script The script contents to evalute, must not be null. * @param classPath The additional class path for the script interpreter, may be null or empty if only * the plugin realm should be used for the script evaluation. If specified, this class path will precede * the artifacts from the plugin class path. * @param globalVariables The global variables (as a mapping from variable name to value) to define for the script, * may be null if not used. * @param scriptOutput A print stream to redirect any output from the script to, may be null to use * stdout/stderr. * @return The return value from the script, can be null * @throws ScriptEvaluationException If the script evaluation produced an error. */ Object evaluateScript( String script, List classPath, Map globalVariables, PrintStream scriptOutput ) throws ScriptEvaluationException; } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/InvokerProperties.java0000644000175000017500000002302111267653240031266 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.util.ArrayList; import java.util.Arrays; import java.util.Properties; import org.apache.maven.shared.invoker.InvocationRequest; import org.codehaus.plexus.util.StringUtils; /** * Provides a convenient facade around the invoker.properties. * * @author Benjamin Bentmann * @version $Id: InvokerProperties.java 828136 2009-10-21 18:44:48Z stephenc $ */ class InvokerProperties { /** * The invoker properties being wrapped, never null. */ private final Properties properties; /** * The constant for the invoker property. */ private static final String PROJECT = "invoker.project"; /** * The constant for the invoker property. */ private static final String GOALS = "invoker.goals"; /** * The constant for the invoker property. */ private static final String PROFILES = "invoker.profiles"; /** * The constant for the invoker property. */ private static final String MAVEN_OPTS = "invoker.mavenOpts"; /** * The constant for the invoker property. */ private static final String FAILURE_BEHAVIOR = "invoker.failureBehavior"; /** * The constant for the invoker property. */ private static final String NON_RECURSIVE = "invoker.nonRecursive"; /** * The constant for the invoker property. */ private static final String OFFLINE = "invoker.offline"; /** * The constant for the invoker property. */ private static final String SYSTEM_PROPERTIES_FILE = "invoker.systemPropertiesFile"; /** * Creates a new facade for the specified invoker properties. The properties will not be copied, so any changes to * them will be reflected by the facade. * * @param properties The invoker properties to wrap, may be null if none. */ public InvokerProperties( Properties properties ) { this.properties = ( properties != null ) ? properties : new Properties(); } /** * Gets the invoker properties being wrapped. * * @return The invoker properties being wrapped, never null. */ public Properties getProperties() { return this.properties; } /** * Gets the name of the corresponding build job. * * @return The name of the build job or an empty string if not set. */ public String getJobName() { return this.properties.getProperty( "invoker.name", "" ); } /** * Gets the description of the corresponding build job. * * @return The description of the build job or an empty string if not set. */ public String getJobDescription() { return this.properties.getProperty( "invoker.description", "" ); } /** * Gets the specification of JRE versions on which this build job should be run. * * @return The specification of JRE versions or an empty string if not set. */ public String getJreVersion() { return this.properties.getProperty( "invoker.java.version", "" ); } /** * Gets the specification of Maven versions on which this build job should be run. * * @return The specification of Maven versions on which this build job should be run. * @since 1.5 */ public String getMavenVersion() { return this.properties.getProperty( "invoker.maven.version", "" ); } /** * Gets the specification of OS families on which this build job should be run. * * @return The specification of OS families or an empty string if not set. */ public String getOsFamily() { return this.properties.getProperty( "invoker.os.family", "" ); } /** * Determines whether these invoker properties contain a build definition for the specified invocation index. * * @param index The one-based index of the invocation to check for, must not be negative. * @return true if the invocation with the specified index is defined, false otherwise. */ public boolean isInvocationDefined( int index ) { String[] keys = { PROJECT, GOALS, PROFILES, MAVEN_OPTS, FAILURE_BEHAVIOR, NON_RECURSIVE, OFFLINE, SYSTEM_PROPERTIES_FILE }; for ( int i = 0; i < keys.length; i++ ) { if ( properties.getProperty( keys[i] + '.' + index ) != null ) { return true; } } return false; } /** * Configures the specified invocation request from these invoker properties. Settings not present in the invoker * properties will be left unchanged in the invocation request. * * @param request The invocation request to configure, must not be null. * @param index The one-based index of the invocation to configure, must not be negative. */ public void configureInvocation( InvocationRequest request, int index ) { String project = get( PROJECT, index ); if ( project != null ) { File file = new File( request.getBaseDirectory(), project ); if ( file.isFile() ) { request.setBaseDirectory( file.getParentFile() ); request.setPomFile( file ); } else { request.setBaseDirectory( file ); request.setPomFile( null ); } } String goals = get( GOALS, index ); if ( goals != null ) { request.setGoals( new ArrayList( Arrays.asList( StringUtils.split( goals, ", \t\n\r\f" ) ) ) ); } String profiles = get( PROFILES, index ); if ( profiles != null ) { request.setProfiles( new ArrayList( Arrays.asList( StringUtils.split( profiles, ", \t\n\r\f" ) ) ) ); } String mvnOpts = get( MAVEN_OPTS, index ); if ( mvnOpts != null ) { request.setMavenOpts( mvnOpts ); } String failureBehavior = get( FAILURE_BEHAVIOR, index ); if ( failureBehavior != null ) { request.setFailureBehavior( failureBehavior ); } String nonRecursive = get( NON_RECURSIVE, index ); if ( nonRecursive != null ) { request.setRecursive( !Boolean.valueOf( nonRecursive ).booleanValue() ); } String offline = get( OFFLINE, index ); if ( offline != null ) { request.setOffline( Boolean.valueOf( offline ).booleanValue() ); } } /** * Checks whether the specified exit code matches the one expected for the given invocation. * * @param exitCode The exit code of the Maven invocation to check. * @param index The index of the invocation for which to check the exit code, must not be negative. * @return true if the exit code is zero and a success was expected or if the exit code is non-zero and * a failue was expected, false otherwise. */ public boolean isExpectedResult( int exitCode, int index ) { boolean nonZeroExit = "failure".equalsIgnoreCase( get( "invoker.buildResult", index ) ); return ( exitCode != 0 ) == nonZeroExit; } /** * Gets the path to the properties file used to set the system properties for the specified execution. * * @param index The index of the invocation for which to check the exit code, must not be negative. * @return The path to the properties file or null if not set. */ public String getSystemPropertiesFile( int index ) { return get( SYSTEM_PROPERTIES_FILE, index ); } /** * Gets a value from the invoker properties. The invoker properties are intended to describe the invocation settings * for multiple builds of the same project. For this reason, the properties are indexed. First, a property named * key.index will be queried. If this property does not exist, the value of the property named * key will finally be returned. * * @param key The (base) key for the invoker property to lookup, must not be null. * @param index The index of the invocation for which to retrieve the value, must not be negative. * @return The value for the requested invoker property or null if not defined. */ String get( String key, int index ) { if ( index < 0 ) { throw new IllegalArgumentException( "invalid invocation index: " + index ); } String value = properties.getProperty( key + '.' + index ); if ( value == null ) { value = properties.getProperty( key ); } return value; } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/FileLogger.java0000644000175000017500000001034311047107157027613 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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 org.apache.maven.plugin.logging.Log; import org.apache.maven.shared.invoker.InvocationOutputHandler; import org.codehaus.plexus.util.IOUtil; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintStream; /** * @version $Id: FileLogger.java 684034 2008-08-08 18:20:31Z bentmann $ */ class FileLogger implements InvocationOutputHandler { /** * The path to the log file. */ private File file; /** * The underlying file stream this logger writes to. */ private PrintStream stream; /** * A flag whether the output stream should be closed during finalization of this logger. */ private boolean shouldFinalize = true; /** * The optional mojo logger to additionally write messages to, can be nulll. */ private final Log log; /** * Creates a new logger that writes to the specified file. * * @param outputFile The path to the output file, must not be null. * @throws IOException If the output file could not be created. */ public FileLogger( File outputFile ) throws IOException { this( outputFile, null ); } /** * Creates a new logger that writes to the specified file and optionally mirrors messages to the given mojo logger. * * @param outputFile The path to the output file, must not be null. * @param log The mojo logger to additionally output messages to, may be null if not used. * @throws IOException If the output file could not be created. */ public FileLogger( File outputFile, Log log ) throws IOException { this.file = outputFile; this.log = log; outputFile.getParentFile().mkdirs(); stream = new PrintStream( new FileOutputStream( outputFile ) ); Runnable finalizer = new Runnable() { public void run() { try { finalize(); } catch ( Throwable e ) { // ignore } } }; Runtime.getRuntime().addShutdownHook( new Thread( finalizer ) ); } /** * Gets the path to the output file. * * @return The path to the output file, never null. */ public File getOutputFile() { return file; } /** * Gets the underlying stream used to write message to the log file. * * @return The underlying stream used to write message to the log file, never null. */ public PrintStream getPrintStream() { return stream; } /** * Writes the specified line to the log file and optionally to the mojo logger. * * @param line The message to log. */ public void consumeLine( String line ) { stream.println( line ); stream.flush(); if ( log != null ) { log.info( line ); } } /** * Closes the underlying file stream. */ public void close() { if ( stream != null ) { stream.flush(); } IOUtil.close( stream ); } /** * Closes the underlying file stream. */ protected void finalize() { if ( shouldFinalize ) { close(); } } } maven-invoker-plugin-1.5/src/main/java/org/apache/maven/plugin/invoker/PomUtils.java0000644000175000017500000000434311150621463027347 0ustar tonytonypackage org.apache.maven.plugin.invoker; /* * 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.IOException; import java.io.Reader; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.plugin.MojoExecutionException; import org.codehaus.plexus.util.IOUtil; import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** * Provides utility methods for POM processing. * * @author Benjamin Bentmann */ class PomUtils { /** * Loads the (raw) model from the specified POM file. * * @param pomFile The path to the POM file to load, must not be null. * @return The raw model, never null. * @throws MojoExecutionException If the POM file could not be loaded. */ public static Model loadPom( File pomFile ) throws MojoExecutionException { Reader reader = null; try { reader = ReaderFactory.newXmlReader( pomFile ); return new MavenXpp3Reader().read( reader, false ); } catch ( XmlPullParserException e ) { throw new MojoExecutionException( "Failed to parse POM: " + pomFile, e ); } catch ( IOException e ) { throw new MojoExecutionException( "Failed to read POM: " + pomFile, e ); } finally { IOUtil.close( reader ); } } } maven-invoker-plugin-1.5/src/main/mdo/0000755000175000017500000000000011623526250016474 5ustar tonytonymaven-invoker-plugin-1.5/src/main/mdo/invocation.mdo0000644000175000017500000001514011140143601021334 0ustar tonytony build-job BuildJob A build job processed by the Maven Invoker Plugin. package org.apache.maven.plugin.invoker.model namespace BuildJob Describes a build job processed by the Maven Invoker Plugin. A build job can consist of a pre-build hook script, one ore more invocations of Maven and a post-build hook script. 1.0.0 project 1.0.0 true String The path to the project to build. This path is usually relative and can denote both a POM file or a project directory. name 1.0.0 false String The name of this build job. description 1.0.0 false String The description of this build job. result 1.0.0 true String The result of this build job. failureMessage 1.0.0 false String Any failure message(s) in case this build job failed. time 1.0.0 true double The number of seconds that this build job took to complete. type 1.0.0 true String The type of the build job. 1.0.0+ 1.0.0+ 1.0.0+ -Dinvoker.test=xxx,yyy parameter. */ public static final String DIRECT = "direct"; } ]]> 1.0.0+ maven-invoker-plugin-1.5/src/main/resources/0000755000175000017500000000000011623526250017727 5ustar tonytonymaven-invoker-plugin-1.5/src/main/resources/invoker-report_de.properties0000644000175000017500000000320611146067650025510 0ustar tonytony# 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. report.invoker.result.description = Die Ergebnisse der Maven-Ausf\u00FChrungen. report.invoker.result.name = Invoker-Build-Ergebnisse report.invoker.result.title = Invoker-Bericht report.invoker.summary.title = Zusammenfassungen report.invoker.summary.number = Builds report.invoker.summary.success = Erfolge report.invoker.summary.failed = Fehlschl\u00E4ge report.invoker.summary.success.rate = Erfolgsrate report.invoker.summary.time.total = Gesamtzeit report.invoker.summary.time.avg = Durchschnittszeit report.invoker.detail.title = Build-Details report.invoker.detail.name = Name report.invoker.detail.result = Ergebnis report.invoker.detail.time = Zeit report.invoker.detail.message = Meldung report.invoker.format.percent = 0.0\u00A0% report.invoker.format.seconds = 0.0\u00A0s maven-invoker-plugin-1.5/src/main/resources/invoker-report.properties0000644000175000017500000000313211146067650025036 0ustar tonytony# 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. report.invoker.result.description = The results of the Maven invocations. report.invoker.result.name = Invoker Build Results report.invoker.result.title = Invoker Report report.invoker.summary.title = Summary report.invoker.summary.number = Builds report.invoker.summary.success = Success report.invoker.summary.failed = Failures report.invoker.summary.success.rate = Success Rate report.invoker.summary.time.total = Total Time report.invoker.summary.time.avg = Avg Time report.invoker.detail.title = Build Details report.invoker.detail.name = Name report.invoker.detail.result = Result report.invoker.detail.time = Time report.invoker.detail.message = Message report.invoker.format.percent = 0.0% report.invoker.format.seconds = 0.0\u00A0s maven-invoker-plugin-1.5/src/main/resources/invoker-report_fr.properties0000644000175000017500000000316111150624733025523 0ustar tonytony# 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. report.invoker.result.description = Resultat des invocations de Maven report.invoker.result.name = Invoker Resultat de builds report.invoker.result.title = Invoker Rapport report.invoker.summary.title = Sommaire report.invoker.summary.number = Builds report.invoker.summary.success = Reussis report.invoker.summary.failed = Echechs report.invoker.summary.success.rate = Pourcentage de reussite report.invoker.summary.time.total = Temps total report.invoker.summary.time.avg = Temps moyen report.invoker.detail.title = Details de Build report.invoker.detail.name = Nom report.invoker.detail.result = Resultat report.invoker.detail.time = Temps report.invoker.detail.message = Message report.invoker.format.percent = 0.0% report.invoker.format.seconds = 0.0\u00A0s maven-invoker-plugin-1.5/src/main/resources/invoker-report_en.properties0000644000175000017500000000227311146061137025517 0ustar tonytony# 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. # NOTE: # This bundle is intentionally empty because English strings are provided by the base bundle via the parent chain. It # must be provided nevertheless such that a request for locale "en" will not erroneously pick up the bundle for the # JVM's default locale (which need not be "en"). See the method javadoc about # ResourceBundle.getBundle(String, Locale, ClassLoader) # for a full description of the lookup strategy.