mirror of https://github.com/apache/maven.git
Java7 here too...
This commit is contained in:
parent
184f474c44
commit
248f1b4be5
|
@ -1,17 +1,6 @@
|
||||||
package org.apache.maven.it;
|
package org.apache.maven.it;
|
||||||
|
|
||||||
import java.io.File;
|
import com.google.common.io.ByteStreams;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.eclipse.jetty.security.ConstraintMapping;
|
import org.eclipse.jetty.security.ConstraintMapping;
|
||||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||||
import org.eclipse.jetty.security.HashLoginService;
|
import org.eclipse.jetty.security.HashLoginService;
|
||||||
|
@ -25,7 +14,16 @@ import org.eclipse.jetty.util.security.Password;
|
||||||
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
import org.eclipse.jetty.util.thread.QueuedThreadPool;
|
||||||
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
|
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
|
||||||
|
|
||||||
import com.google.common.io.ByteStreams;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An HTTP server that handles all requests on a given port from a specified source, optionally secured using BASIC auth
|
* An HTTP server that handles all requests on a given port from a specified source, optionally secured using BASIC auth
|
||||||
|
@ -184,7 +182,7 @@ public class HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static interface StreamSource
|
public interface StreamSource
|
||||||
{
|
{
|
||||||
InputStream stream( String path )
|
InputStream stream( String path )
|
||||||
throws IOException;
|
throws IOException;
|
||||||
|
@ -208,7 +206,9 @@ public class HttpServer
|
||||||
{
|
{
|
||||||
response.setContentType( "application/octet-stream" );
|
response.setContentType( "application/octet-stream" );
|
||||||
response.setStatus( HttpServletResponse.SC_OK );
|
response.setStatus( HttpServletResponse.SC_OK );
|
||||||
try(InputStream in = source.stream( target.substring( 1 ) ); OutputStream out = response.getOutputStream() ) {
|
try ( InputStream in = source.stream(
|
||||||
|
target.substring( 1 ) ); OutputStream out = response.getOutputStream() )
|
||||||
|
{
|
||||||
ByteStreams.copy( in, out );
|
ByteStreams.copy( in, out );
|
||||||
}
|
}
|
||||||
baseRequest.setHandled( true );
|
baseRequest.setHandled( true );
|
||||||
|
|
|
@ -35,9 +35,8 @@ class ItUtils
|
||||||
{
|
{
|
||||||
MessageDigest digester = MessageDigest.getInstance( algo );
|
MessageDigest digester = MessageDigest.getInstance( algo );
|
||||||
|
|
||||||
FileInputStream is = new FileInputStream( file );
|
|
||||||
DigestInputStream dis;
|
DigestInputStream dis;
|
||||||
try
|
try ( FileInputStream is = new FileInputStream( file ) )
|
||||||
{
|
{
|
||||||
dis = new DigestInputStream( is, digester );
|
dis = new DigestInputStream( is, digester );
|
||||||
|
|
||||||
|
@ -46,18 +45,14 @@ class ItUtils
|
||||||
// just read it
|
// just read it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
is.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] digest = digester.digest();
|
byte[] digest = digester.digest();
|
||||||
|
|
||||||
StringBuffer hash = new StringBuffer( digest.length * 2 );
|
StringBuilder hash = new StringBuilder( digest.length * 2 );
|
||||||
|
|
||||||
for ( int i = 0; i < digest.length; i++ )
|
for ( byte aDigest : digest )
|
||||||
{
|
{
|
||||||
int b = digest[i] & 0xFF;
|
int b = aDigest & 0xFF;
|
||||||
|
|
||||||
if ( b < 0x10 )
|
if ( b < 0x10 )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -45,7 +44,7 @@ public class MavenIT0090EnvVarInterpolationTest
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0090" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/it0090" );
|
||||||
|
|
||||||
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
Verifier verifier = newVerifier( testDir.getAbsolutePath() );
|
||||||
Map<String, String> envVars = new HashMap<String, String>();
|
Map<String, String> envVars = new HashMap<>();
|
||||||
envVars.put( "MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE" );
|
envVars.put( "MAVEN_TEST_ENVAR", "MAVEN_TEST_ENVAR_VALUE" );
|
||||||
verifier.setAutoclean( false );
|
verifier.setAutoclean( false );
|
||||||
verifier.deleteDirectory( "target" );
|
verifier.deleteDirectory( "target" );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -28,7 +27,6 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
@ -56,7 +54,7 @@ public class MavenIT0144LifecycleExecutionOrderTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
|
|
||||||
expected.add( "pre-clean" );
|
expected.add( "pre-clean" );
|
||||||
expected.add( "clean" );
|
expected.add( "clean" );
|
||||||
|
|
|
@ -19,14 +19,12 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -79,11 +77,11 @@ public class MavenITmng0187CollectedProjectsTest
|
||||||
|
|
||||||
private List<String> getProjects( Properties props )
|
private List<String> getProjects( Properties props )
|
||||||
{
|
{
|
||||||
List<String> projects = new ArrayList<String>();
|
List<String> projects = new ArrayList<>();
|
||||||
|
|
||||||
for ( Iterator<?> it = props.keySet().iterator(); it.hasNext(); )
|
for ( Object o : props.keySet() )
|
||||||
{
|
{
|
||||||
String key = it.next().toString();
|
String key = o.toString();
|
||||||
if ( key.startsWith( "project.collectedProjects." ) && !key.endsWith( ".size" ) )
|
if ( key.startsWith( "project.collectedProjects." ) && !key.endsWith( ".size" ) )
|
||||||
{
|
{
|
||||||
projects.add( props.getProperty( key ) );
|
projects.add( props.getProperty( key ) );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -81,9 +80,9 @@ public class MavenITmng1021EqualAttachmentBuildNumberTest
|
||||||
private String getSnapshotVersion( File artifactDir )
|
private String getSnapshotVersion( File artifactDir )
|
||||||
{
|
{
|
||||||
File[] files = artifactDir.listFiles();
|
File[] files = artifactDir.listFiles();
|
||||||
for ( int i = 0; i < files.length; i++ )
|
for ( File file : files )
|
||||||
{
|
{
|
||||||
String name = files[i].getName();
|
String name = file.getName();
|
||||||
if ( name.endsWith( ".pom" ) )
|
if ( name.endsWith( ".pom" ) )
|
||||||
{
|
{
|
||||||
return name.substring( "test-".length(), name.length() - ".pom".length() );
|
return name.substring( "test-".length(), name.length() - ".pom".length() );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -67,7 +66,7 @@ public class MavenITmng1803PomValidationErrorIncludesLineNumberTest
|
||||||
List<String> lines = verifier.loadLines( verifier.getLogFileName(), null );
|
List<String> lines = verifier.loadLines( verifier.getLogFileName(), null );
|
||||||
for ( String line : lines )
|
for ( String line : lines )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( ":bad/id:" ) >= 0 )
|
if ( line.contains( ":bad/id:" ) )
|
||||||
{
|
{
|
||||||
assertTrue( "Line number not found in: " + line, line.indexOf( "38" ) > 0 );
|
assertTrue( "Line number not found in: " + line, line.indexOf( "38" ) > 0 );
|
||||||
assertTrue( "Column number not found in: " + line, line.indexOf( "19" ) > 0 );
|
assertTrue( "Column number not found in: " + line, line.indexOf( "19" ) > 0 );
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2362">MNG-2362</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2362">MNG-2362</a>.
|
||||||
*
|
*
|
||||||
|
@ -93,7 +93,7 @@ public class MavenITmng2362DeployedPomEncodingTest
|
||||||
String prefix = "TEST-CHARS: ";
|
String prefix = "TEST-CHARS: ";
|
||||||
int pos = pom.indexOf( prefix );
|
int pos = pom.indexOf( prefix );
|
||||||
assertTrue( "Corrupt data " + pom.substring( pos, pos + prefix.length() + chars.length() ) + " in " + pomFile,
|
assertTrue( "Corrupt data " + pom.substring( pos, pos + prefix.length() + chars.length() ) + " in " + pomFile,
|
||||||
pom.indexOf( prefix + chars ) >= 0 );
|
pom.contains( prefix + chars ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.VerificationException;
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -29,11 +27,9 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2739">MNG-2739</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2739">MNG-2739</a>.
|
||||||
*
|
*
|
||||||
* @todo Fill in a better description of what this test verifies!
|
|
||||||
*
|
|
||||||
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
||||||
* @author jdcasey
|
* @author jdcasey
|
||||||
*
|
* @todo Fill in a better description of what this test verifies!
|
||||||
*/
|
*/
|
||||||
public class MavenITmng2739RequiredRepositoryElementsTest
|
public class MavenITmng2739RequiredRepositoryElementsTest
|
||||||
extends AbstractMavenIntegrationTestCase
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
@ -57,8 +53,8 @@ public class MavenITmng2739RequiredRepositoryElementsTest
|
||||||
{
|
{
|
||||||
verifier.executeGoal( "validate" );
|
verifier.executeGoal( "validate" );
|
||||||
|
|
||||||
fail( "POM should NOT validate: repository <id/> element is missing in: "
|
fail(
|
||||||
+ new File( testDir, "pom.xml" ) );
|
"POM should NOT validate: repository <id/> element is missing in: " + new File( testDir, "pom.xml" ) );
|
||||||
}
|
}
|
||||||
catch ( VerificationException e )
|
catch ( VerificationException e )
|
||||||
{
|
{
|
||||||
|
@ -71,7 +67,7 @@ public class MavenITmng2739RequiredRepositoryElementsTest
|
||||||
boolean foundNpe = false;
|
boolean foundNpe = false;
|
||||||
for ( String line : listing )
|
for ( String line : listing )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( "NullPointerException" ) > -1 )
|
if ( line.contains( "NullPointerException" ) )
|
||||||
{
|
{
|
||||||
foundNpe = true;
|
foundNpe = true;
|
||||||
break;
|
break;
|
||||||
|
@ -97,8 +93,8 @@ public class MavenITmng2739RequiredRepositoryElementsTest
|
||||||
{
|
{
|
||||||
verifier.executeGoal( "validate" );
|
verifier.executeGoal( "validate" );
|
||||||
|
|
||||||
fail( "POM should NOT validate: repository <url/> element is missing in: "
|
fail(
|
||||||
+ new File( testDir, "pom.xml" ) );
|
"POM should NOT validate: repository <url/> element is missing in: " + new File( testDir, "pom.xml" ) );
|
||||||
}
|
}
|
||||||
catch ( VerificationException e )
|
catch ( VerificationException e )
|
||||||
{
|
{
|
||||||
|
@ -111,7 +107,7 @@ public class MavenITmng2739RequiredRepositoryElementsTest
|
||||||
boolean foundNpe = false;
|
boolean foundNpe = false;
|
||||||
for ( String line : listing )
|
for ( String line : listing )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( "NullPointerException" ) > -1 )
|
if ( line.contains( "NullPointerException" ) )
|
||||||
{
|
{
|
||||||
foundNpe = true;
|
foundNpe = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2820">MNG-2820</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2820">MNG-2820</a>.
|
||||||
*
|
*
|
||||||
|
@ -78,7 +78,7 @@ public class MavenITmng2820PomCommentsTest
|
||||||
private void assertPomComment( String pom, String comment )
|
private void assertPomComment( String pom, String comment )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
assertTrue( "Missing comment: " + comment, pom.indexOf( comment ) >= 0 );
|
assertTrue( "Missing comment: " + comment, pom.contains( comment ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.VerificationException;
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -32,7 +30,6 @@ import java.util.List;
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2883">MNG-2883</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-2883">MNG-2883</a>.
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class MavenITmng2883LegacyRepoOfflineTest
|
public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
extends AbstractMavenIntegrationTestCase
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
@ -72,7 +69,8 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
}
|
}
|
||||||
catch ( VerificationException e )
|
catch ( VerificationException e )
|
||||||
{
|
{
|
||||||
throw new VerificationException( "Build should succeed the first time through when NOT in offline mode!", e );
|
throw new VerificationException( "Build should succeed the first time through when NOT in offline mode!",
|
||||||
|
e );
|
||||||
}
|
}
|
||||||
|
|
||||||
// the centerpiece of these tests!
|
// the centerpiece of these tests!
|
||||||
|
@ -97,7 +95,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> missingMessages = new ArrayList<String>();
|
List<String> missingMessages = new ArrayList<>();
|
||||||
missingMessages.add( " is offline" );
|
missingMessages.add( " is offline" );
|
||||||
missingMessages.add( "org.apache.maven.its.mng2883:parent:pom:1.0-SNAPSHOT" );
|
missingMessages.add( "org.apache.maven.its.mng2883:parent:pom:1.0-SNAPSHOT" );
|
||||||
|
|
||||||
|
@ -109,7 +107,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
{
|
{
|
||||||
String message = messageIt.next();
|
String message = messageIt.next();
|
||||||
|
|
||||||
if ( line.indexOf( message ) > -1 )
|
if ( line.contains( message ) )
|
||||||
{
|
{
|
||||||
messageIt.remove();
|
messageIt.remove();
|
||||||
}
|
}
|
||||||
|
@ -118,7 +116,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
|
|
||||||
if ( !missingMessages.isEmpty() )
|
if ( !missingMessages.isEmpty() )
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
buffer.append( "The following key messages were missing from build output:\n\n" );
|
buffer.append( "The following key messages were missing from build output:\n\n" );
|
||||||
|
|
||||||
|
@ -164,7 +162,8 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
}
|
}
|
||||||
catch ( VerificationException e )
|
catch ( VerificationException e )
|
||||||
{
|
{
|
||||||
throw new VerificationException( "Build should succeed the first time through when NOT in offline mode!", e );
|
throw new VerificationException( "Build should succeed the first time through when NOT in offline mode!",
|
||||||
|
e );
|
||||||
}
|
}
|
||||||
|
|
||||||
// the centerpiece of these tests!
|
// the centerpiece of these tests!
|
||||||
|
@ -189,7 +188,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> missingMessages = new ArrayList<String>();
|
List<String> missingMessages = new ArrayList<>();
|
||||||
|
|
||||||
// FIXME: We need a more prominent diagnosis including system being in offline mode for 2.0.x.
|
// FIXME: We need a more prominent diagnosis including system being in offline mode for 2.0.x.
|
||||||
missingMessages.add( "offline mode." );
|
missingMessages.add( "offline mode." );
|
||||||
|
@ -203,7 +202,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
{
|
{
|
||||||
String message = (String) messageIt.next();
|
String message = (String) messageIt.next();
|
||||||
|
|
||||||
if ( line.indexOf( message ) > -1 )
|
if ( line.contains( message ) )
|
||||||
{
|
{
|
||||||
messageIt.remove();
|
messageIt.remove();
|
||||||
}
|
}
|
||||||
|
@ -212,7 +211,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
|
|
||||||
if ( !missingMessages.isEmpty() )
|
if ( !missingMessages.isEmpty() )
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
buffer.append( "The following key messages were missing from build output:\n\n" );
|
buffer.append( "The following key messages were missing from build output:\n\n" );
|
||||||
|
|
||||||
|
@ -274,7 +273,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> missingMessages = new ArrayList<String>();
|
List<String> missingMessages = new ArrayList<>();
|
||||||
missingMessages.add( " is offline" );
|
missingMessages.add( " is offline" );
|
||||||
missingMessages.add( "org.apache.maven.its.mng2883:plugin" );
|
missingMessages.add( "org.apache.maven.its.mng2883:plugin" );
|
||||||
|
|
||||||
|
@ -286,7 +285,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
{
|
{
|
||||||
String message = messageIt.next();
|
String message = messageIt.next();
|
||||||
|
|
||||||
if ( line.indexOf( message ) > -1 )
|
if ( line.contains( message ) )
|
||||||
{
|
{
|
||||||
messageIt.remove();
|
messageIt.remove();
|
||||||
}
|
}
|
||||||
|
@ -295,7 +294,7 @@ public class MavenITmng2883LegacyRepoOfflineTest
|
||||||
|
|
||||||
if ( !missingMessages.isEmpty() )
|
if ( !missingMessages.isEmpty() )
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
buffer.append( "The following key messages were missing from build output:\n\n" );
|
buffer.append( "The following key messages were missing from build output:\n\n" );
|
||||||
|
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.VerificationException;
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -50,7 +48,8 @@ public class MavenITmng3220ImportScopeTest
|
||||||
verifier.setAutoclean( false );
|
verifier.setAutoclean( false );
|
||||||
verifier.deleteDirectory( "target" );
|
verifier.deleteDirectory( "target" );
|
||||||
verifier.deleteArtifacts( "org.apache.maven.its.mng3220" );
|
verifier.deleteArtifacts( "org.apache.maven.its.mng3220" );
|
||||||
verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
|
verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8",
|
||||||
|
verifier.newDefaultFilterProperties() );
|
||||||
verifier.addCliOption( "--settings" );
|
verifier.addCliOption( "--settings" );
|
||||||
verifier.addCliOption( "settings.xml" );
|
verifier.addCliOption( "settings.xml" );
|
||||||
verifier.executeGoal( "validate" );
|
verifier.executeGoal( "validate" );
|
||||||
|
@ -69,7 +68,8 @@ public class MavenITmng3220ImportScopeTest
|
||||||
verifier.setAutoclean( false );
|
verifier.setAutoclean( false );
|
||||||
verifier.deleteDirectory( "target" );
|
verifier.deleteDirectory( "target" );
|
||||||
verifier.deleteArtifacts( "org.apache.maven.its.mng3220" );
|
verifier.deleteArtifacts( "org.apache.maven.its.mng3220" );
|
||||||
verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
|
verifier.filterFile( "../settings-template.xml", "settings.xml", "UTF-8",
|
||||||
|
verifier.newDefaultFilterProperties() );
|
||||||
verifier.addCliOption( "--settings" );
|
verifier.addCliOption( "--settings" );
|
||||||
verifier.addCliOption( "settings.xml" );
|
verifier.addCliOption( "settings.xml" );
|
||||||
|
|
||||||
|
@ -91,8 +91,8 @@ public class MavenITmng3220ImportScopeTest
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
for ( String line : lines )
|
for ( String line : lines )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( "\'dependencies.dependency.version\' is missing for junit:junit" ) > -1
|
if ( line.contains( "\'dependencies.dependency.version\' is missing for junit:junit" ) || line.contains(
|
||||||
|| line.indexOf( "\'dependencies.dependency.version\' for junit:junit:jar is missing" ) > -1 )
|
"\'dependencies.dependency.version\' for junit:junit:jar is missing" ) )
|
||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,15 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
import org.mortbay.jetty.Handler;
|
import org.mortbay.jetty.Handler;
|
||||||
|
@ -35,6 +26,14 @@ import org.mortbay.jetty.Request;
|
||||||
import org.mortbay.jetty.Server;
|
import org.mortbay.jetty.Server;
|
||||||
import org.mortbay.jetty.handler.AbstractHandler;
|
import org.mortbay.jetty.handler.AbstractHandler;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3415">MNG-3415</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3415">MNG-3415</a>.
|
||||||
*
|
*
|
||||||
|
@ -56,9 +55,9 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
/**
|
/**
|
||||||
* This test simply verifies that when a metadata transfer fails (network error, etc.)
|
* This test simply verifies that when a metadata transfer fails (network error, etc.)
|
||||||
* no metadata file is written to the local repository.
|
* no metadata file is written to the local repository.
|
||||||
*
|
* <p/>
|
||||||
* Steps executed to verify this test:
|
* Steps executed to verify this test:
|
||||||
*
|
* <p/>
|
||||||
* 0. Find the local repository directory:
|
* 0. Find the local repository directory:
|
||||||
* a. build the maven-find-local-repo-plugin, then run it, to spit out the path of the
|
* a. build the maven-find-local-repo-plugin, then run it, to spit out the path of the
|
||||||
* local repository in use by default. Read the output file to get this path.
|
* local repository in use by default. Read the output file to get this path.
|
||||||
|
@ -126,9 +125,9 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
/**
|
/**
|
||||||
* This test simply verifies that when metadata doesn't exist on the remote
|
* This test simply verifies that when metadata doesn't exist on the remote
|
||||||
* repository, a basic metadata file is written to the local repository.
|
* repository, a basic metadata file is written to the local repository.
|
||||||
*
|
* <p/>
|
||||||
* Steps executed to verify this test:
|
* Steps executed to verify this test:
|
||||||
*
|
* <p/>
|
||||||
* 0. Find the local repository directory:
|
* 0. Find the local repository directory:
|
||||||
* a. build the maven-find-local-repo-plugin, then run it, to spit out the path of the
|
* a. build the maven-find-local-repo-plugin, then run it, to spit out the path of the
|
||||||
* local repository in use by default. Read the output file to get this path.
|
* local repository in use by default. Read the output file to get this path.
|
||||||
|
@ -159,7 +158,7 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
verifier.setAutoclean( false );
|
verifier.setAutoclean( false );
|
||||||
verifier.deleteArtifacts( "org.apache.maven.its.mng3415" );
|
verifier.deleteArtifacts( "org.apache.maven.its.mng3415" );
|
||||||
|
|
||||||
final List<String> requestUris = new ArrayList<String>();
|
final List<String> requestUris = new ArrayList<>();
|
||||||
|
|
||||||
Handler repoHandler = new AbstractHandler()
|
Handler repoHandler = new AbstractHandler()
|
||||||
{
|
{
|
||||||
|
@ -199,8 +198,8 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
|
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
assertTrue( requestUris.toString(),
|
assertTrue( requestUris.toString(), requestUris.contains(
|
||||||
requestUris.contains( "/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) );
|
"/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) );
|
||||||
|
|
||||||
requestUris.clear();
|
requestUris.clear();
|
||||||
|
|
||||||
|
@ -215,10 +214,13 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
assertFalse( requestUris.toString(),
|
assertFalse( requestUris.toString(), requestUris.contains(
|
||||||
requestUris.contains( "/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) );
|
"/org/apache/maven/its/mng3415/missing/1.0-SNAPSHOT/maven-metadata.xml" ) );
|
||||||
|
|
||||||
assertEquals( "Last-modified time should be unchanged from first build through second build for the file we use for updateInterval checks.", firstLastMod, updateCheckFile.lastModified() );
|
assertEquals(
|
||||||
|
"Last-modified time should be unchanged from first build through second build for the file we use for"
|
||||||
|
+ " updateInterval checks.",
|
||||||
|
firstLastMod, updateCheckFile.lastModified() );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -231,8 +233,8 @@ public class MavenITmng3415JunkRepositoryMetadataTest
|
||||||
{
|
{
|
||||||
File metadata = getMetadataFile( verifier );
|
File metadata = getMetadataFile( verifier );
|
||||||
|
|
||||||
assertFalse( "Metadata file should NOT be present in local repository: "
|
assertFalse( "Metadata file should NOT be present in local repository: " + metadata.getAbsolutePath(),
|
||||||
+ metadata.getAbsolutePath(), metadata.exists() );
|
metadata.exists() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupDummyDependency( Verifier verifier, File testDir, boolean resetUpdateInterval )
|
private void setupDummyDependency( Verifier verifier, File testDir, boolean resetUpdateInterval )
|
||||||
|
|
|
@ -19,16 +19,16 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
|
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3441">MNG-3441</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3441">MNG-3441</a>.
|
||||||
*
|
*
|
||||||
|
@ -45,8 +45,7 @@ public class MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest
|
||||||
public void testitMNG3441()
|
public void testitMNG3441()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir =
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3441" );
|
||||||
ResourceExtractor.simpleExtractResources( getClass(), "/mng-3441" );
|
|
||||||
|
|
||||||
File targetRepository = new File( testDir, "target-repo" );
|
File targetRepository = new File( testDir, "target-repo" );
|
||||||
FileUtils.deleteDirectory( targetRepository );
|
FileUtils.deleteDirectory( targetRepository );
|
||||||
|
@ -63,7 +62,8 @@ public class MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
|
|
||||||
Xpp3Dom dom = readDom( new File( targetRepository,
|
Xpp3Dom dom = readDom( new File( targetRepository,
|
||||||
"org/apache/maven/its/mng3441/test-artifact/1.0-SNAPSHOT/maven-metadata.xml" ) );
|
"org/apache/maven/its/mng3441/test-artifact/1.0-SNAPSHOT/maven-metadata.xml"
|
||||||
|
) );
|
||||||
assertEquals( "2", dom.getChild( "versioning" ).getChild( "snapshot" ).getChild( "buildNumber" ).getValue() );
|
assertEquals( "2", dom.getChild( "versioning" ).getChild( "snapshot" ).getChild( "buildNumber" ).getValue() );
|
||||||
|
|
||||||
dom = readDom( new File( targetRepository, "org/apache/maven/its/mng3441/maven-metadata.xml" ) );
|
dom = readDom( new File( targetRepository, "org/apache/maven/its/mng3441/maven-metadata.xml" ) );
|
||||||
|
@ -77,14 +77,9 @@ public class MavenITmng3441MetadataUpdatedFromDeploymentRepositoryTest
|
||||||
private Xpp3Dom readDom( File file )
|
private Xpp3Dom readDom( File file )
|
||||||
throws XmlPullParserException, IOException
|
throws XmlPullParserException, IOException
|
||||||
{
|
{
|
||||||
FileReader reader = new FileReader( file );
|
try ( FileReader reader = new FileReader( file ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
return Xpp3DomBuilder.build( reader );
|
return Xpp3DomBuilder.build( reader );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
reader.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,19 +19,18 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3710">MNG-3710</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3710">MNG-3710</a>.
|
||||||
*
|
*
|
||||||
* @todo Fill in a better description of what this test verifies!
|
|
||||||
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
|
||||||
* @author jdcasey
|
* @author jdcasey
|
||||||
|
* @todo Fill in a better description of what this test verifies!
|
||||||
*/
|
*/
|
||||||
public class MavenITmng3710PollutedClonedPluginsTest
|
public class MavenITmng3710PollutedClonedPluginsTest
|
||||||
extends AbstractMavenIntegrationTestCase
|
extends AbstractMavenIntegrationTestCase
|
||||||
|
@ -44,8 +43,7 @@ public class MavenITmng3710PollutedClonedPluginsTest
|
||||||
public void testitMNG3710_POMInheritance()
|
public void testitMNG3710_POMInheritance()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir =
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/pom-inheritance" );
|
||||||
ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/pom-inheritance" );
|
|
||||||
File pluginDir = new File( testDir, "maven-mng3710-pomInheritance-plugin" );
|
File pluginDir = new File( testDir, "maven-mng3710-pomInheritance-plugin" );
|
||||||
File projectsDir = new File( testDir, "projects" );
|
File projectsDir = new File( testDir, "projects" );
|
||||||
|
|
||||||
|
@ -77,8 +75,7 @@ public class MavenITmng3710PollutedClonedPluginsTest
|
||||||
public void testitMNG3710_OriginalModel()
|
public void testitMNG3710_OriginalModel()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
File testDir =
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/original-model" );
|
||||||
ResourceExtractor.simpleExtractResources( getClass(), "/mng-3710/original-model" );
|
|
||||||
File pluginsDir = new File( testDir, "plugins" );
|
File pluginsDir = new File( testDir, "plugins" );
|
||||||
File projectDir = new File( testDir, "project" );
|
File projectDir = new File( testDir, "project" );
|
||||||
|
|
||||||
|
@ -92,7 +89,7 @@ public class MavenITmng3710PollutedClonedPluginsTest
|
||||||
|
|
||||||
verifier = newVerifier( projectDir.getAbsolutePath() );
|
verifier = newVerifier( projectDir.getAbsolutePath() );
|
||||||
|
|
||||||
List<String> goals = new ArrayList<String>();
|
List<String> goals = new ArrayList<>();
|
||||||
goals.add( "org.apache.maven.its.mng3710:mavenit-mng3710-directInvoke-plugin:1:run" );
|
goals.add( "org.apache.maven.its.mng3710:mavenit-mng3710-directInvoke-plugin:1:run" );
|
||||||
goals.add( "validate" );
|
goals.add( "validate" );
|
||||||
|
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3719">MNG-3719</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3719">MNG-3719</a>.
|
||||||
*
|
*
|
||||||
|
@ -67,7 +67,7 @@ public class MavenITmng3719PomExecutionOrderingTest
|
||||||
Matcher m = pattern.matcher( line );
|
Matcher m = pattern.matcher( line );
|
||||||
if ( m.matches() )
|
if ( m.matches() )
|
||||||
{
|
{
|
||||||
int step = Integer.valueOf( m.group( 1 ) ).intValue();
|
int step = Integer.valueOf( m.group( 1 ) );
|
||||||
stepLines[step - 1] = i + 1;
|
stepLines[step - 1] = i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -63,7 +62,7 @@ public class MavenITmng3732ActiveProfilesTest
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
Properties props = verifier.loadProperties( "target/profile.properties" );
|
Properties props = verifier.loadProperties( "target/profile.properties" );
|
||||||
List<String> ids = new ArrayList<String>();
|
List<String> ids = new ArrayList<>();
|
||||||
|
|
||||||
// support for profiles.xml removed from 3.x (see MNG-4060)
|
// support for profiles.xml removed from 3.x (see MNG-4060)
|
||||||
if ( matchesVersionRange( "[2.0,3.0-alpha-1)" ) )
|
if ( matchesVersionRange( "[2.0,3.0-alpha-1)" ) )
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -73,7 +72,7 @@ public class MavenITmng3807PluginConfigExpressionEvaluationTest
|
||||||
{
|
{
|
||||||
assertNotNull( value );
|
assertNotNull( value );
|
||||||
assertTrue( value.length() > 0 );
|
assertTrue( value.length() > 0 );
|
||||||
assertTrue( value, value.indexOf( "${" ) < 0 );
|
assertTrue( value, !value.contains( "${" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,10 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -100,7 +98,8 @@ public class MavenITmng3843PomInheritanceTest
|
||||||
assertEquals( "1", props.getProperty( "project.build.resources" ) );
|
assertEquals( "1", props.getProperty( "project.build.resources" ) );
|
||||||
assertPathEquals( basedir, "src/main/resources", props.getProperty( "project.build.resources.0.directory" ) );
|
assertPathEquals( basedir, "src/main/resources", props.getProperty( "project.build.resources.0.directory" ) );
|
||||||
assertEquals( "1", props.getProperty( "project.build.testResources" ) );
|
assertEquals( "1", props.getProperty( "project.build.testResources" ) );
|
||||||
assertPathEquals( basedir, "src/test/resources", props.getProperty( "project.build.testResources.0.directory" ) );
|
assertPathEquals( basedir, "src/test/resources",
|
||||||
|
props.getProperty( "project.build.testResources.0.directory" ) );
|
||||||
assertPathEquals( basedir, "target", props.getProperty( "project.build.directory" ) );
|
assertPathEquals( basedir, "target", props.getProperty( "project.build.directory" ) );
|
||||||
assertPathEquals( basedir, "target/classes", props.getProperty( "project.build.outputDirectory" ) );
|
assertPathEquals( basedir, "target/classes", props.getProperty( "project.build.outputDirectory" ) );
|
||||||
assertPathEquals( basedir, "target/test-classes", props.getProperty( "project.build.testOutputDirectory" ) );
|
assertPathEquals( basedir, "target/test-classes", props.getProperty( "project.build.testOutputDirectory" ) );
|
||||||
|
@ -147,9 +146,11 @@ public class MavenITmng3843PomInheritanceTest
|
||||||
assertEquals( "http://parent.url/ci", props.getProperty( "project.ciManagement.url" ) );
|
assertEquals( "http://parent.url/ci", props.getProperty( "project.ciManagement.url" ) );
|
||||||
assertEquals( "http://parent.url/issues", props.getProperty( "project.issueManagement.url" ) );
|
assertEquals( "http://parent.url/issues", props.getProperty( "project.issueManagement.url" ) );
|
||||||
assertEquals( "http://parent.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) );
|
assertEquals( "http://parent.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) );
|
||||||
assertEquals( "http://parent.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) );
|
assertEquals( "http://parent.url/snaps",
|
||||||
|
props.getProperty( "project.distributionManagement.snapshotRepository.url" ) );
|
||||||
assertUrlCommon( "http://parent.url/site", props.getProperty( "project.distributionManagement.site.url" ) );
|
assertUrlCommon( "http://parent.url/site", props.getProperty( "project.distributionManagement.site.url" ) );
|
||||||
assertUrlCommon( "http://parent.url/download", props.getProperty( "project.distributionManagement.downloadUrl" ) );
|
assertUrlCommon( "http://parent.url/download",
|
||||||
|
props.getProperty( "project.distributionManagement.downloadUrl" ) );
|
||||||
if ( matchesVersionRange( "(2.0.2,)" ) )
|
if ( matchesVersionRange( "(2.0.2,)" ) )
|
||||||
{
|
{
|
||||||
assertMissing( props, "project.distributionManagement.relocation." );
|
assertMissing( props, "project.distributionManagement.relocation." );
|
||||||
|
@ -214,9 +215,11 @@ public class MavenITmng3843PomInheritanceTest
|
||||||
assertEquals( "http://child.url/ci", props.getProperty( "project.ciManagement.url" ) );
|
assertEquals( "http://child.url/ci", props.getProperty( "project.ciManagement.url" ) );
|
||||||
assertEquals( "http://child.url/issues", props.getProperty( "project.issueManagement.url" ) );
|
assertEquals( "http://child.url/issues", props.getProperty( "project.issueManagement.url" ) );
|
||||||
assertEquals( "http://child.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) );
|
assertEquals( "http://child.url/dist", props.getProperty( "project.distributionManagement.repository.url" ) );
|
||||||
assertEquals( "http://child.url/snaps", props.getProperty( "project.distributionManagement.snapshotRepository.url" ) );
|
assertEquals( "http://child.url/snaps",
|
||||||
|
props.getProperty( "project.distributionManagement.snapshotRepository.url" ) );
|
||||||
assertUrlCommon( "http://child.url/site", props.getProperty( "project.distributionManagement.site.url" ) );
|
assertUrlCommon( "http://child.url/site", props.getProperty( "project.distributionManagement.site.url" ) );
|
||||||
assertUrlCommon( "http://child.url/download", props.getProperty( "project.distributionManagement.downloadUrl" ) );
|
assertUrlCommon( "http://child.url/download",
|
||||||
|
props.getProperty( "project.distributionManagement.downloadUrl" ) );
|
||||||
assertEquals( "child-reloc-msg", props.getProperty( "project.distributionManagement.relocation.message" ) );
|
assertEquals( "child-reloc-msg", props.getProperty( "project.distributionManagement.relocation.message" ) );
|
||||||
assertMissing( props, "project.profiles." );
|
assertMissing( props, "project.profiles." );
|
||||||
assertEquals( "coreit", props.getProperty( "project.build.finalName" ) );
|
assertEquals( "coreit", props.getProperty( "project.build.finalName" ) );
|
||||||
|
@ -239,22 +242,22 @@ public class MavenITmng3843PomInheritanceTest
|
||||||
assertEquals( "1", props.getProperty( "project.build.plugins" ) );
|
assertEquals( "1", props.getProperty( "project.build.plugins" ) );
|
||||||
}
|
}
|
||||||
assertEquals( "4", props.getProperty( "project.dependencies" ) );
|
assertEquals( "4", props.getProperty( "project.dependencies" ) );
|
||||||
Collection<String> actualDeps = new TreeSet<String>();
|
Collection<String> actualDeps = new TreeSet<>();
|
||||||
actualDeps.add( props.getProperty( "project.dependencies.0.artifactId" ) );
|
actualDeps.add( props.getProperty( "project.dependencies.0.artifactId" ) );
|
||||||
actualDeps.add( props.getProperty( "project.dependencies.1.artifactId" ) );
|
actualDeps.add( props.getProperty( "project.dependencies.1.artifactId" ) );
|
||||||
actualDeps.add( props.getProperty( "project.dependencies.2.artifactId" ) );
|
actualDeps.add( props.getProperty( "project.dependencies.2.artifactId" ) );
|
||||||
actualDeps.add( props.getProperty( "project.dependencies.3.artifactId" ) );
|
actualDeps.add( props.getProperty( "project.dependencies.3.artifactId" ) );
|
||||||
Collection<String> expectedDeps = new TreeSet<String>();
|
Collection<String> expectedDeps = new TreeSet<>();
|
||||||
expectedDeps.add( "parent-dep-b" );
|
expectedDeps.add( "parent-dep-b" );
|
||||||
expectedDeps.add( "child-dep-b" );
|
expectedDeps.add( "child-dep-b" );
|
||||||
expectedDeps.add( "child-dep-c" );
|
expectedDeps.add( "child-dep-c" );
|
||||||
expectedDeps.add( "child-dep-d" );
|
expectedDeps.add( "child-dep-d" );
|
||||||
assertEquals( expectedDeps, actualDeps );
|
assertEquals( expectedDeps, actualDeps );
|
||||||
assertEquals( "2", props.getProperty( "project.dependencyManagement.dependencies" ) );
|
assertEquals( "2", props.getProperty( "project.dependencyManagement.dependencies" ) );
|
||||||
Collection<String> actualMngtDeps = new TreeSet<String>();
|
Collection<String> actualMngtDeps = new TreeSet<>();
|
||||||
actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) );
|
actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.0.artifactId" ) );
|
||||||
actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.1.artifactId" ) );
|
actualMngtDeps.add( props.getProperty( "project.dependencyManagement.dependencies.1.artifactId" ) );
|
||||||
Collection<String> expectedMngtDeps = new TreeSet<String>();
|
Collection<String> expectedMngtDeps = new TreeSet<>();
|
||||||
expectedMngtDeps.add( "parent-dep-a" );
|
expectedMngtDeps.add( "parent-dep-a" );
|
||||||
expectedMngtDeps.add( "child-dep-a" );
|
expectedMngtDeps.add( "child-dep-a" );
|
||||||
assertEquals( expectedMngtDeps, actualMngtDeps );
|
assertEquals( expectedMngtDeps, actualMngtDeps );
|
||||||
|
@ -286,9 +289,9 @@ public class MavenITmng3843PomInheritanceTest
|
||||||
|
|
||||||
private void assertMissing( Properties props, String prefix )
|
private void assertMissing( Properties props, String prefix )
|
||||||
{
|
{
|
||||||
for ( Iterator<?> it = props.keySet().iterator(); it.hasNext(); )
|
for ( Object o : props.keySet() )
|
||||||
{
|
{
|
||||||
String key = it.next().toString();
|
String key = o.toString();
|
||||||
assertFalse( "Found unexpected key: " + key, key.startsWith( prefix ) );
|
assertFalse( "Found unexpected key: " + key, key.startsWith( prefix ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,14 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
import org.apache.maven.shared.utils.Os;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
|
||||||
import org.apache.maven.shared.utils.Os;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3940">MNG-3940</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-3940">MNG-3940</a>.
|
||||||
*
|
*
|
||||||
|
@ -51,7 +51,7 @@ public class MavenITmng3940EnvVarInterpolationTest
|
||||||
{
|
{
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3940" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3940" );
|
||||||
|
|
||||||
Map<String, String> envVars = new HashMap<String, String>();
|
Map<String, String> envVars = new HashMap<>();
|
||||||
/*
|
/*
|
||||||
* NOTE: The POM is using MAVEN_MNG_3940 to reference the var (just as one would refer to PATH). On Windows,
|
* NOTE: The POM is using MAVEN_MNG_3940 to reference the var (just as one would refer to PATH). On Windows,
|
||||||
* this must resolve case-insensitively so we use different character casing for the variable here.
|
* this must resolve case-insensitively so we use different character casing for the variable here.
|
||||||
|
|
|
@ -19,12 +19,12 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4091">MNG-4091</a>:
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4091">MNG-4091</a>:
|
||||||
* Bad plugin descriptor error handling
|
* Bad plugin descriptor error handling
|
||||||
|
@ -61,7 +61,6 @@ public class MavenITmng4091BadPluginDescriptorTest
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<String> logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
|
List<String> logFile = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
|
||||||
|
|
||||||
String msg = "Plugin's descriptor contains the wrong version: 2.0-SNAPSHOT";
|
String msg = "Plugin's descriptor contains the wrong version: 2.0-SNAPSHOT";
|
||||||
|
@ -69,7 +68,7 @@ public class MavenITmng4091BadPluginDescriptorTest
|
||||||
boolean foundMessage = false;
|
boolean foundMessage = false;
|
||||||
for ( String line : logFile )
|
for ( String line : logFile )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( msg ) > -1 )
|
if ( line.contains( msg ) )
|
||||||
{
|
{
|
||||||
foundMessage = true;
|
foundMessage = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -64,7 +63,7 @@ public class MavenITmng4180PerDependencyExclusionsTest
|
||||||
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
||||||
Collections.sort( artifacts );
|
Collections.sort( artifacts );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "org.apache.maven.its.mng4180:a:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4180:a:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4180:b:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4180:b:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4180:c:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4180:c:jar:0.1" );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -66,7 +65,7 @@ public class MavenITmng4190MirrorRepoMergingTest
|
||||||
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
||||||
Collections.sort( artifacts );
|
Collections.sort( artifacts );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "org.apache.maven.its.mng4190:a:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4190:a:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4190:b:jar:0.1-SNAPSHOT" );
|
expected.add( "org.apache.maven.its.mng4190:b:jar:0.1-SNAPSHOT" );
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -63,7 +62,7 @@ public class MavenITmng4203TransitiveDependencyExclusionTest
|
||||||
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
||||||
Collections.sort( artifacts );
|
Collections.sort( artifacts );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "org.apache.maven.its.mng4203:b:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4203:b:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4203:c:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4203:c:jar:0.1" );
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class MavenITmng4235HttpAuthDeploymentChecksumsTest
|
||||||
public static class RepoHandler
|
public static class RepoHandler
|
||||||
extends ResourceHandler
|
extends ResourceHandler
|
||||||
{
|
{
|
||||||
List<DeployedResource> deployedResources = new ArrayList<DeployedResource>();
|
List<DeployedResource> deployedResources = new ArrayList<>();
|
||||||
|
|
||||||
public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
|
public void handle( String target, HttpServletRequest request, HttpServletResponse response, int dispatch )
|
||||||
throws IOException, ServletException
|
throws IOException, ServletException
|
||||||
|
@ -193,18 +193,12 @@ public class MavenITmng4235HttpAuthDeploymentChecksumsTest
|
||||||
dir.mkdirs();
|
dir.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputStream os = resource.getOutputStream();
|
|
||||||
|
|
||||||
request.getContentLength();
|
request.getContentLength();
|
||||||
|
|
||||||
try
|
try ( OutputStream os = resource.getOutputStream() )
|
||||||
{
|
{
|
||||||
IO.copy( request.getInputStream(), os );
|
IO.copy( request.getInputStream(), os );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
DeployedResource deployedResource = new DeployedResource();
|
DeployedResource deployedResource = new DeployedResource();
|
||||||
|
|
||||||
|
|
|
@ -63,16 +63,17 @@ public class MavenITmng4275RelocationWarningTest
|
||||||
{
|
{
|
||||||
if ( foundWarning )
|
if ( foundWarning )
|
||||||
{
|
{
|
||||||
assertTrue(
|
assertTrue( "Relocation target should have been logged right after warning.", line.contains(
|
||||||
"Relocation target should have been logged right after warning.",
|
"This artifact has been relocated to org.apache.maven.its.mng4275:relocated:1" ) );
|
||||||
line.indexOf( "This artifact has been relocated to org.apache.maven.its.mng4275:relocated:1" ) > -1 );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ( line.startsWith( "[WARNING] While downloading org.apache.maven.its.mng4275:relocation:1" ) )
|
else if ( line.startsWith( "[WARNING] While downloading org.apache.maven.its.mng4275:relocation:1" ) )
|
||||||
{
|
{
|
||||||
foundWarning = true;
|
foundWarning = true;
|
||||||
}
|
}
|
||||||
else if ( line.matches( "\\[WARNING\\].* org.apache.maven.its.mng4275:relocation:jar:1 .* org.apache.maven.its.mng4275:relocated:jar:1.*" ) )
|
else if ( line.matches(
|
||||||
|
"\\[WARNING\\].* org.apache.maven.its.mng4275:relocation:jar:1 .* org.apache.maven.its"
|
||||||
|
+ ".mng4275:relocated:jar:1.*" ) )
|
||||||
{
|
{
|
||||||
foundWarning = true;
|
foundWarning = true;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,9 +19,15 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
import org.mortbay.jetty.Handler;
|
||||||
|
import org.mortbay.jetty.Request;
|
||||||
|
import org.mortbay.jetty.Server;
|
||||||
|
import org.mortbay.jetty.handler.AbstractHandler;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
@ -30,15 +36,6 @@ import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.mortbay.jetty.Handler;
|
|
||||||
import org.mortbay.jetty.Request;
|
|
||||||
import org.mortbay.jetty.Server;
|
|
||||||
import org.mortbay.jetty.handler.AbstractHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4326">MNG-4326</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4326">MNG-4326</a>.
|
||||||
*
|
*
|
||||||
|
@ -71,7 +68,7 @@ public class MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
final List<String> uris = new ArrayList<String>();
|
final List<String> uris = new ArrayList<>();
|
||||||
|
|
||||||
Handler repoHandler = new AbstractHandler()
|
Handler repoHandler = new AbstractHandler()
|
||||||
{
|
{
|
||||||
|
@ -82,8 +79,8 @@ public class MavenITmng4326LocalSnapshotSuppressesRemoteCheckTest
|
||||||
|
|
||||||
String uri = request.getRequestURI();
|
String uri = request.getRequestURI();
|
||||||
|
|
||||||
if ( uri.startsWith( "/repo/org/apache/maven/its/mng4326" )
|
if ( uri.startsWith( "/repo/org/apache/maven/its/mng4326" ) && !uri.endsWith( ".md5" ) && !uri.endsWith(
|
||||||
&& !uri.endsWith( ".md5" ) && !uri.endsWith( ".sha1" ) )
|
".sha1" ) )
|
||||||
{
|
{
|
||||||
uris.add( uri.substring( 34 ) );
|
uris.add( uri.substring( 34 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -54,14 +53,16 @@ public class MavenITmng4353PluginDependencyResolutionFromPomRepoTest
|
||||||
Properties filterProps = verifier.newDefaultFilterProperties();
|
Properties filterProps = verifier.newDefaultFilterProperties();
|
||||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", filterProps );
|
||||||
verifier.filterFile( "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/template.pom",
|
verifier.filterFile( "repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/template.pom",
|
||||||
"repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/maven-mng4353-plugin-0.1.pom", "UTF-8", filterProps );
|
"repo-1/org/apache/maven/its/mng4353/maven-mng4353-plugin/0.1/maven-mng4353-plugin-0.1"
|
||||||
|
+ ".pom",
|
||||||
|
"UTF-8", filterProps );
|
||||||
verifier.addCliOption( "--settings" );
|
verifier.addCliOption( "--settings" );
|
||||||
verifier.addCliOption( "settings.xml" );
|
verifier.addCliOption( "settings.xml" );
|
||||||
verifier.executeGoal( "validate" );
|
verifier.executeGoal( "validate" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
Properties props = verifier.loadProperties( "target/touch.properties" );;
|
Properties props = verifier.loadProperties( "target/touch.properties" );
|
||||||
assertEquals( "passed", props.getProperty( "test" ) );
|
assertEquals( "passed", props.getProperty( "test" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,11 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4368">MNG-4368</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4368">MNG-4368</a>.
|
||||||
*
|
*
|
||||||
|
@ -63,11 +63,12 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
File installedPom = new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "pom" ) );
|
File installedPom =
|
||||||
|
new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "pom" ) );
|
||||||
|
|
||||||
String pom = FileUtils.fileRead( installedPom, "UTF-8" );
|
String pom = FileUtils.fileRead( installedPom, "UTF-8" );
|
||||||
assertTrue( pom.indexOf( "Branch-A" ) > 0 );
|
assertTrue( pom.indexOf( "Branch-A" ) > 0 );
|
||||||
assertTrue( pom.indexOf( "Branch-B" ) < 0 );
|
assertTrue( !pom.contains( "Branch-B" ) );
|
||||||
|
|
||||||
assertEquals( aPom.length(), bPom.length() );
|
assertEquals( aPom.length(), bPom.length() );
|
||||||
assertTrue( aPom.lastModified() > bPom.lastModified() );
|
assertTrue( aPom.lastModified() > bPom.lastModified() );
|
||||||
|
@ -81,7 +82,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
pom = FileUtils.fileRead( installedPom, "UTF-8" );
|
pom = FileUtils.fileRead( installedPom, "UTF-8" );
|
||||||
assertTrue( pom.indexOf( "Branch-A" ) < 0 );
|
assertTrue( !pom.contains( "Branch-A" ) );
|
||||||
assertTrue( pom.indexOf( "Branch-B" ) > 0 );
|
assertTrue( pom.indexOf( "Branch-B" ) > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +115,12 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
File installedArtifact = new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "jar" ) );
|
File installedArtifact =
|
||||||
|
new File( verifier.getArtifactPath( "org.apache.maven.its.mng4368", "test", "0.1-SNAPSHOT", "jar" ) );
|
||||||
|
|
||||||
String data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
String data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
||||||
assertTrue( data.indexOf( "Branch-A" ) > 0 );
|
assertTrue( data.indexOf( "Branch-A" ) > 0 );
|
||||||
assertTrue( data.indexOf( "Branch-B" ) < 0 );
|
assertTrue( !data.contains( "Branch-B" ) );
|
||||||
|
|
||||||
assertEquals( aArtifact.length(), bArtifact.length() );
|
assertEquals( aArtifact.length(), bArtifact.length() );
|
||||||
assertTrue( aArtifact.lastModified() > bArtifact.lastModified() );
|
assertTrue( aArtifact.lastModified() > bArtifact.lastModified() );
|
||||||
|
@ -132,7 +134,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
||||||
assertTrue( data.indexOf( "Branch-A" ) < 0 );
|
assertTrue( !data.contains( "Branch-A" ) );
|
||||||
assertTrue( data.indexOf( "Branch-B" ) > 0 );
|
assertTrue( data.indexOf( "Branch-B" ) > 0 );
|
||||||
|
|
||||||
long lastModified = installedArtifact.lastModified();
|
long lastModified = installedArtifact.lastModified();
|
||||||
|
@ -148,7 +150,7 @@ public class MavenITmng4368TimestampAwareArtifactInstallerTest
|
||||||
verifier.resetStreams();
|
verifier.resetStreams();
|
||||||
|
|
||||||
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
data = FileUtils.fileRead( installedArtifact, "UTF-8" );
|
||||||
assertTrue( data.indexOf( "Branch-B" ) < 0 );
|
assertTrue( !data.contains( "Branch-B" ) );
|
||||||
assertTrue( data.indexOf( "Branch-C" ) > 0 );
|
assertTrue( data.indexOf( "Branch-C" ) > 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -65,7 +64,7 @@ public class MavenITmng4403LenientDependencyPomParsingTest
|
||||||
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
List<String> artifacts = verifier.loadLines( "target/artifacts.txt", "UTF-8" );
|
||||||
Collections.sort( artifacts );
|
Collections.sort( artifacts );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "org.apache.maven.its.mng4403:a:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4403:a:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4403:b:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4403:b:jar:0.1" );
|
||||||
expected.add( "org.apache.maven.its.mng4403:c:jar:0.1" );
|
expected.add( "org.apache.maven.its.mng4403:c:jar:0.1" );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -62,7 +61,7 @@ public class MavenITmng4415InheritedPluginOrderTest
|
||||||
Properties props = verifier.loadProperties( "target/it.properties" );
|
Properties props = verifier.loadProperties( "target/it.properties" );
|
||||||
assertNotNull( props.getProperty( "project.build.plugins" ) );
|
assertNotNull( props.getProperty( "project.build.plugins" ) );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "maven-it-plugin-error" );
|
expected.add( "maven-it-plugin-error" );
|
||||||
expected.add( "maven-it-plugin-configuration" );
|
expected.add( "maven-it-plugin-configuration" );
|
||||||
expected.add( "maven-it-plugin-dependency-resolution" );
|
expected.add( "maven-it-plugin-dependency-resolution" );
|
||||||
|
@ -72,7 +71,7 @@ public class MavenITmng4415InheritedPluginOrderTest
|
||||||
expected.add( "maven-it-plugin-fork" );
|
expected.add( "maven-it-plugin-fork" );
|
||||||
expected.add( "maven-it-plugin-touch" );
|
expected.add( "maven-it-plugin-touch" );
|
||||||
|
|
||||||
List<String> actual = new ArrayList<String>();
|
List<String> actual = new ArrayList<>();
|
||||||
|
|
||||||
int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) );
|
int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) );
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( int i = 0; i < count; i++ )
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -62,7 +61,7 @@ public class MavenITmng4416PluginOrderAfterProfileInjectionTest
|
||||||
Properties props = verifier.loadProperties( "target/it.properties" );
|
Properties props = verifier.loadProperties( "target/it.properties" );
|
||||||
assertNotNull( props.getProperty( "project.build.plugins" ) );
|
assertNotNull( props.getProperty( "project.build.plugins" ) );
|
||||||
|
|
||||||
List<String> expected = new ArrayList<String>();
|
List<String> expected = new ArrayList<>();
|
||||||
expected.add( "maven-it-plugin-error" );
|
expected.add( "maven-it-plugin-error" );
|
||||||
expected.add( "maven-it-plugin-configuration" );
|
expected.add( "maven-it-plugin-configuration" );
|
||||||
expected.add( "maven-it-plugin-dependency-resolution" );
|
expected.add( "maven-it-plugin-dependency-resolution" );
|
||||||
|
@ -72,7 +71,7 @@ public class MavenITmng4416PluginOrderAfterProfileInjectionTest
|
||||||
expected.add( "maven-it-plugin-fork" );
|
expected.add( "maven-it-plugin-fork" );
|
||||||
expected.add( "maven-it-plugin-touch" );
|
expected.add( "maven-it-plugin-touch" );
|
||||||
|
|
||||||
List<String> actual = new ArrayList<String>();
|
List<String> actual = new ArrayList<>();
|
||||||
|
|
||||||
int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) );
|
int count = Integer.parseInt( props.getProperty( "project.build.plugins" ) );
|
||||||
for ( int i = 0; i < count; i++ )
|
for ( int i = 0; i < count; i++ )
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -68,11 +67,11 @@ public class MavenITmng4421DeprecatedPomInterpolationExpressionsTest
|
||||||
{
|
{
|
||||||
if ( line.startsWith( "[WARN" ) )
|
if ( line.startsWith( "[WARN" ) )
|
||||||
{
|
{
|
||||||
if ( line.indexOf( "${pom.version}" ) >= 0 )
|
if ( line.contains( "${pom.version}" ) )
|
||||||
{
|
{
|
||||||
warnedPomPrefix = true;
|
warnedPomPrefix = true;
|
||||||
}
|
}
|
||||||
if ( line.indexOf( "${version}" ) >= 0 )
|
if ( line.contains( "${version}" ) )
|
||||||
{
|
{
|
||||||
warnedEmptyPrefix = true;
|
warnedEmptyPrefix = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.it.utils.DeployedResource;
|
import org.apache.maven.it.utils.DeployedResource;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -44,6 +33,15 @@ import org.mortbay.jetty.security.ConstraintMapping;
|
||||||
import org.mortbay.jetty.security.HashUserRealm;
|
import org.mortbay.jetty.security.HashUserRealm;
|
||||||
import org.mortbay.jetty.security.SecurityHandler;
|
import org.mortbay.jetty.security.SecurityHandler;
|
||||||
|
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4470">MNG-4470</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4470">MNG-4470</a>.
|
||||||
*
|
*
|
||||||
|
@ -60,7 +58,7 @@ public class MavenITmng4470AuthenticatedDeploymentToProxyTest
|
||||||
|
|
||||||
private volatile boolean deployed;
|
private volatile boolean deployed;
|
||||||
|
|
||||||
List<DeployedResource> deployedResources = new ArrayList<DeployedResource>();
|
List<DeployedResource> deployedResources = new ArrayList<>();
|
||||||
|
|
||||||
public MavenITmng4470AuthenticatedDeploymentToProxyTest()
|
public MavenITmng4470AuthenticatedDeploymentToProxyTest()
|
||||||
{
|
{
|
||||||
|
@ -201,7 +199,7 @@ public class MavenITmng4470AuthenticatedDeploymentToProxyTest
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
deployedResources = new ArrayList<DeployedResource>();
|
deployedResources = new ArrayList<>();
|
||||||
|
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4470/" + project );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4470/" + project );
|
||||||
|
|
||||||
|
|
|
@ -19,23 +19,20 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
import org.mortbay.jetty.Handler;
|
||||||
|
import org.mortbay.jetty.Request;
|
||||||
|
import org.mortbay.jetty.Server;
|
||||||
|
import org.mortbay.jetty.handler.AbstractHandler;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.mortbay.jetty.Handler;
|
|
||||||
import org.mortbay.jetty.Request;
|
|
||||||
import org.mortbay.jetty.Server;
|
|
||||||
import org.mortbay.jetty.handler.AbstractHandler;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4555">MNG-4555</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4555">MNG-4555</a>.
|
||||||
*
|
*
|
||||||
|
@ -58,7 +55,7 @@ public class MavenITmng4555MetaversionResolutionOfflineTest
|
||||||
{
|
{
|
||||||
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4555" );
|
File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-4555" );
|
||||||
|
|
||||||
final List<String> uris = new ArrayList<String>();
|
final List<String> uris = new ArrayList<>();
|
||||||
|
|
||||||
Handler repoHandler = new AbstractHandler()
|
Handler repoHandler = new AbstractHandler()
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,12 +19,10 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -97,10 +95,10 @@ public class MavenITmng4666CoreRealmImportTest
|
||||||
|
|
||||||
private List<String> getTypes( Properties props )
|
private List<String> getTypes( Properties props )
|
||||||
{
|
{
|
||||||
List<String> types = new ArrayList<String>();
|
List<String> types = new ArrayList<>();
|
||||||
for ( Iterator<?> it = props.keySet().iterator(); it.hasNext(); )
|
for ( Object o : props.keySet() )
|
||||||
{
|
{
|
||||||
String key = it.next().toString();
|
String key = o.toString();
|
||||||
if ( key.startsWith( "core." ) )
|
if ( key.startsWith( "core." ) )
|
||||||
{
|
{
|
||||||
String type = key.substring( 5 );
|
String type = key.substring( 5 );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -63,7 +62,7 @@ public class MavenITmng4696MavenProjectDependencyArtifactsTest
|
||||||
Properties props = verifier.loadProperties( "target/artifact.properties" );
|
Properties props = verifier.loadProperties( "target/artifact.properties" );
|
||||||
assertEquals( "3", props.getProperty( "project.dependencyArtifacts.size" ) );
|
assertEquals( "3", props.getProperty( "project.dependencyArtifacts.size" ) );
|
||||||
|
|
||||||
HashSet<String> ids = new HashSet<String>();
|
HashSet<String> ids = new HashSet<>();
|
||||||
ids.add( props.getProperty( "project.dependencyArtifacts.0.artifactId" ) );
|
ids.add( props.getProperty( "project.dependencyArtifacts.0.artifactId" ) );
|
||||||
ids.add( props.getProperty( "project.dependencyArtifacts.1.artifactId" ) );
|
ids.add( props.getProperty( "project.dependencyArtifacts.1.artifactId" ) );
|
||||||
ids.add( props.getProperty( "project.dependencyArtifacts.2.artifactId" ) );
|
ids.add( props.getProperty( "project.dependencyArtifacts.2.artifactId" ) );
|
||||||
|
|
|
@ -19,12 +19,12 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
import org.apache.maven.shared.utils.io.FileUtils;
|
import org.apache.maven.shared.utils.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4745">MNG-4745</a>.
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-4745">MNG-4745</a>.
|
||||||
*
|
*
|
||||||
|
@ -142,7 +142,7 @@ public class MavenITmng4745PluginVersionUpdateTest
|
||||||
private static void writeMetadata( File testdir, String version, String timestamp )
|
private static void writeMetadata( File testdir, String version, String timestamp )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
StringBuffer content = new StringBuffer( 1024 );
|
StringBuilder content = new StringBuilder( 1024 );
|
||||||
content.append( "<?xml version=\"1.0\"?>\n" );
|
content.append( "<?xml version=\"1.0\"?>\n" );
|
||||||
content.append( "<metadata>\n" );
|
content.append( "<metadata>\n" );
|
||||||
content.append( " <groupId>org.apache.maven.its.mng4745</groupId>\n" );
|
content.append( " <groupId>org.apache.maven.its.mng4745</groupId>\n" );
|
||||||
|
|
|
@ -19,7 +19,6 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.it.Verifier;
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -57,7 +56,7 @@ public class MavenITmng4814ReResolutionOfDependenciesDuringReactorTest
|
||||||
verifier.addCliOption( "-s" );
|
verifier.addCliOption( "-s" );
|
||||||
verifier.addCliOption( "settings.xml" );
|
verifier.addCliOption( "settings.xml" );
|
||||||
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
|
verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() );
|
||||||
List<String> goals = new ArrayList<String>();
|
List<String> goals = new ArrayList<>();
|
||||||
goals.add( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test" );
|
goals.add( "org.apache.maven.its.plugins:maven-it-plugin-dependency-resolution:2.1-SNAPSHOT:aggregate-test" );
|
||||||
goals.add( "validate" );
|
goals.add( "validate" );
|
||||||
verifier.executeGoals( goals );
|
verifier.executeGoals( goals );
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
package org.apache.maven.it;
|
package org.apache.maven.it;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||||||
* or more contributor license agreements. See the NOTICE file
|
* or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -26,7 +25,8 @@ import org.apache.maven.it.util.ResourceExtractor;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class MavenITmng5214DontMapWsdlToJar extends AbstractMavenIntegrationTestCase
|
public class MavenITmng5214DontMapWsdlToJar
|
||||||
|
extends AbstractMavenIntegrationTestCase
|
||||||
{
|
{
|
||||||
public MavenITmng5214DontMapWsdlToJar()
|
public MavenITmng5214DontMapWsdlToJar()
|
||||||
{
|
{
|
||||||
|
@ -61,11 +61,10 @@ public class MavenITmng5214DontMapWsdlToJar extends AbstractMavenIntegrationTest
|
||||||
verifier.executeGoal( "test" );
|
verifier.executeGoal( "test" );
|
||||||
verifier.verifyErrorFreeLog();
|
verifier.verifyErrorFreeLog();
|
||||||
List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
|
List<String> lines = verifier.loadFile( verifier.getBasedir(), verifier.getLogFileName(), false );
|
||||||
Iterator<String> lineIt = lines.iterator();
|
// RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it
|
||||||
// RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT $ /tmp/it.repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl
|
// .repo/org/apache/maven/its/mng5214/dependency/1.0-SNAPSHOT/dependency-1.0-SNAPSHOT.wsdl
|
||||||
while ( lineIt.hasNext() )
|
for ( String line : lines )
|
||||||
{
|
{
|
||||||
String line = (String) lineIt.next();
|
|
||||||
if ( line.contains( "RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT" ) )
|
if ( line.contains( "RESOLVE-ONE-DEPENDENCY org.apache.maven.its.mng5214:dependency:wsdl:1.0-SNAPSHOT" ) )
|
||||||
{
|
{
|
||||||
assertFalse( line.contains( "classes-main" ) );
|
assertFalse( line.contains( "classes-main" ) );
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class MavenITmng5224InjectedSettings
|
||||||
</profiles>
|
</profiles>
|
||||||
**/
|
**/
|
||||||
|
|
||||||
List<String> profileIds = new ArrayList<String>( 4 );
|
List<String> profileIds = new ArrayList<>( 4 );
|
||||||
|
|
||||||
for ( Xpp3Dom node : profileNodes )
|
for ( Xpp3Dom node : profileNodes )
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ public class MavenITmng5224InjectedSettings
|
||||||
assertEquals( 1, activeProfilesNode.getChildCount() );
|
assertEquals( 1, activeProfilesNode.getChildCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> activeProfiles = new ArrayList<String>( 2 );
|
List<String> activeProfiles = new ArrayList<>( 2 );
|
||||||
|
|
||||||
for ( Xpp3Dom node : activeProfilesNode.getChildren() )
|
for ( Xpp3Dom node : activeProfilesNode.getChildren() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,12 +19,11 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5452">MNG-5452</a>
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5452">MNG-5452</a>
|
||||||
* Make sure that the maven.build.timestamp is in UTC.
|
* Make sure that the maven.build.timestamp is in UTC.
|
||||||
|
|
|
@ -19,13 +19,12 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5608">MNG-5608</a>:
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5608">MNG-5608</a>:
|
||||||
* Profile activation warning test when file specification contains <code>${project.basedir}</code>
|
* Profile activation warning test when file specification contains <code>${project.basedir}</code>
|
||||||
|
@ -68,7 +67,8 @@ public class MavenITmng5608ProfileActivationWarningTest
|
||||||
|
|
||||||
private String findWarning( List<String> logLines, String profileId )
|
private String findWarning( List<String> logLines, String profileId )
|
||||||
{
|
{
|
||||||
Pattern pattern = Pattern.compile( "(?i).*Failed to interpolate file location ..project.basedir./pom.xml for profile " + profileId + ": .*" );
|
Pattern pattern = Pattern.compile(
|
||||||
|
"(?i).*Failed to interpolate file location ..project.basedir./pom.xml for profile " + profileId + ": .*" );
|
||||||
|
|
||||||
for ( String logLine : logLines )
|
for ( String logLine : logLines )
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,9 +22,6 @@ package org.apache.maven.it;
|
||||||
import org.apache.maven.it.util.ResourceExtractor;
|
import org.apache.maven.it.util.ResourceExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5639">MNG-5639</a>:
|
* This is a test set for <a href="http://jira.codehaus.org/browse/MNG-5639">MNG-5639</a>:
|
||||||
|
@ -60,5 +57,4 @@ public class MavenITmng5639ImportScopePomResolutionTest
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class TunnelingProxyServer
|
||||||
private String readLine( PushbackInputStream is )
|
private String readLine( PushbackInputStream is )
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer( 1024 );
|
StringBuilder buffer = new StringBuilder( 1024 );
|
||||||
|
|
||||||
while ( true )
|
while ( true )
|
||||||
{
|
{
|
||||||
|
|
|
@ -48,15 +48,10 @@ public class DefaultStatefulSingleton
|
||||||
{
|
{
|
||||||
propertiesFile.getParentFile().mkdirs();
|
propertiesFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
FileOutputStream os = new FileOutputStream( propertiesFile );
|
try ( FileOutputStream os = new FileOutputStream( propertiesFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
properties.store( os, "MAVEN-CORE-IT" );
|
properties.store( os, "MAVEN-CORE-IT" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -35,10 +34,9 @@ import java.util.Vector;
|
||||||
/**
|
/**
|
||||||
* Checks the thread-safe retrieval of components from active component collections.
|
* Checks the thread-safe retrieval of components from active component collections.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
* @goal check-thread-safety
|
* @goal check-thread-safety
|
||||||
* @phase validate
|
* @phase validate
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
*/
|
*/
|
||||||
public class CheckThreadSafetyMojo
|
public class CheckThreadSafetyMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -114,13 +112,13 @@ public class CheckThreadSafetyMojo
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for ( Iterator it = map.values().iterator(); it.hasNext(); )
|
for ( Object o : map.values() )
|
||||||
{
|
{
|
||||||
it.next().toString();
|
o.toString();
|
||||||
}
|
}
|
||||||
for ( Iterator it = list.iterator(); it.hasNext(); )
|
for ( Object aList : list )
|
||||||
{
|
{
|
||||||
it.next().toString();
|
aList.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
|
@ -135,15 +133,15 @@ public class CheckThreadSafetyMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
go.add( null );
|
go.add( null );
|
||||||
for ( int i = 0; i < threads.length; i++ )
|
for ( Thread thread : threads )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
threads[i].join();
|
thread.join();
|
||||||
}
|
}
|
||||||
catch ( InterruptedException e )
|
catch ( InterruptedException e )
|
||||||
{
|
{
|
||||||
getLog().warn( "[MAVEN-CORE-IT-LOG] Interrupted while joining " + threads[i] );
|
getLog().warn( "[MAVEN-CORE-IT-LOG] Interrupted while joining " + thread );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -35,10 +34,9 @@ import java.util.Properties;
|
||||||
/**
|
/**
|
||||||
* Dumps the role hints of the available repository layouts to a properties file.
|
* Dumps the role hints of the available repository layouts to a properties file.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
* @goal dump-repo-layouts
|
* @goal dump-repo-layouts
|
||||||
* @phase validate
|
* @phase validate
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
*/
|
*/
|
||||||
public class DumpRepoLayoutsMojo
|
public class DumpRepoLayoutsMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -87,9 +85,9 @@ public class DumpRepoLayoutsMojo
|
||||||
|
|
||||||
layoutProperties.setProperty( "layouts", Integer.toString( repositoryLayouts.size() ) );
|
layoutProperties.setProperty( "layouts", Integer.toString( repositoryLayouts.size() ) );
|
||||||
|
|
||||||
for ( Iterator it = repositoryLayouts.keySet().iterator(); it.hasNext(); )
|
for ( Object o : repositoryLayouts.keySet() )
|
||||||
{
|
{
|
||||||
String roleHint = (String) it.next();
|
String roleHint = (String) o;
|
||||||
Object repoLayout = repositoryLayouts.get( roleHint );
|
Object repoLayout = repositoryLayouts.get( roleHint );
|
||||||
if ( repoLayout != null )
|
if ( repoLayout != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,10 +37,9 @@ import java.util.Set;
|
||||||
/**
|
/**
|
||||||
* Collects user-specified artifacts. This mimics in part the Maven Assembly Plugin.
|
* Collects user-specified artifacts. This mimics in part the Maven Assembly Plugin.
|
||||||
*
|
*
|
||||||
* @goal collect
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal collect
|
||||||
*/
|
*/
|
||||||
public class CollectMojo
|
public class CollectMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -110,10 +109,8 @@ public class CollectMojo
|
||||||
|
|
||||||
if ( dependencies != null )
|
if ( dependencies != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dependencies.length; i++ )
|
for ( Dependency dependency : dependencies )
|
||||||
{
|
{
|
||||||
Dependency dependency = dependencies[i];
|
|
||||||
|
|
||||||
Artifact artifact =
|
Artifact artifact =
|
||||||
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
||||||
dependency.getVersion(), dependency.getType(),
|
dependency.getVersion(), dependency.getType(),
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class CustomRepositoryLayout
|
||||||
{
|
{
|
||||||
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
|
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
|
||||||
|
|
||||||
StringBuffer path = new StringBuffer();
|
StringBuilder path = new StringBuilder();
|
||||||
|
|
||||||
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
|
path.append( artifact.getArtifactId() ).append( '-' ).append( artifact.getVersion() );
|
||||||
|
|
||||||
|
|
|
@ -24,16 +24,13 @@ import org.apache.maven.artifact.deployer.ArtifactDeployer;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deploys the project artifacts to the distribution repository. This is the essence of the Maven Deploy Plugin.
|
* Deploys the project artifacts to the distribution repository. This is the essence of the Maven Deploy Plugin.
|
||||||
*
|
*
|
||||||
* @goal deploy
|
|
||||||
* @phase deploy
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal deploy
|
||||||
|
* @phase deploy
|
||||||
*/
|
*/
|
||||||
public class DeployMojo
|
public class DeployMojo
|
||||||
extends AbstractRepoMojo
|
extends AbstractRepoMojo
|
||||||
|
@ -78,9 +75,9 @@ public class DeployMojo
|
||||||
|
|
||||||
if ( attachedArtifacts != null )
|
if ( attachedArtifacts != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = attachedArtifacts.iterator(); it.hasNext(); )
|
for ( Object attachedArtifact1 : attachedArtifacts )
|
||||||
{
|
{
|
||||||
Artifact attachedArtifact = (Artifact) it.next();
|
Artifact attachedArtifact = (Artifact) attachedArtifact1;
|
||||||
deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository,
|
deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository,
|
||||||
localRepository );
|
localRepository );
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,9 +86,9 @@ public class InstallArtifactsMojo
|
||||||
ArtifactRepository artifactRepository =
|
ArtifactRepository artifactRepository =
|
||||||
artifactRepositoryFactory.createDeploymentArtifactRepository( "appassembler", "file://"
|
artifactRepositoryFactory.createDeploymentArtifactRepository( "appassembler", "file://"
|
||||||
+ assembleDirectory.getAbsolutePath() + "/" + repositoryName, artifactRepositoryLayout, false );
|
+ assembleDirectory.getAbsolutePath() + "/" + repositoryName, artifactRepositoryLayout, false );
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Object artifact1 : artifacts )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) artifact1;
|
||||||
|
|
||||||
installArtifact( artifactRepository, artifact );
|
installArtifact( artifactRepository, artifact );
|
||||||
}
|
}
|
||||||
|
@ -128,7 +127,7 @@ public class InstallArtifactsMojo
|
||||||
{
|
{
|
||||||
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
|
ArtifactHandler artifactHandler = artifact.getArtifactHandler();
|
||||||
|
|
||||||
StringBuffer path = new StringBuffer();
|
StringBuilder path = new StringBuilder();
|
||||||
|
|
||||||
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
|
path.append( artifact.getArtifactId() ).append( ARTIFACT_SEPARATOR ).append( artifact.getVersion() );
|
||||||
|
|
||||||
|
@ -152,7 +151,7 @@ public class InstallArtifactsMojo
|
||||||
|
|
||||||
private String pathOfRepositoryMetadata( String filename )
|
private String pathOfRepositoryMetadata( String filename )
|
||||||
{
|
{
|
||||||
StringBuffer path = new StringBuffer();
|
StringBuilder path = new StringBuilder();
|
||||||
|
|
||||||
path.append( filename );
|
path.append( filename );
|
||||||
|
|
||||||
|
|
|
@ -23,16 +23,13 @@ import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
import org.apache.maven.artifact.installer.ArtifactInstaller;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installs the project artifacts into the local repository. This is the essence of the Maven Install Plugin.
|
* Installs the project artifacts into the local repository. This is the essence of the Maven Install Plugin.
|
||||||
*
|
*
|
||||||
* @goal install
|
|
||||||
* @phase install
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal install
|
||||||
|
* @phase install
|
||||||
*/
|
*/
|
||||||
public class InstallMojo
|
public class InstallMojo
|
||||||
extends AbstractRepoMojo
|
extends AbstractRepoMojo
|
||||||
|
@ -68,9 +65,9 @@ public class InstallMojo
|
||||||
|
|
||||||
if ( attachedArtifacts != null )
|
if ( attachedArtifacts != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = attachedArtifacts.iterator(); it.hasNext(); )
|
for ( Object attachedArtifact1 : attachedArtifacts )
|
||||||
{
|
{
|
||||||
Artifact attachedArtifact = (Artifact) it.next();
|
Artifact attachedArtifact = (Artifact) attachedArtifact1;
|
||||||
installer.install( attachedArtifact.getFile(), attachedArtifact, localRepository );
|
installer.install( attachedArtifact.getFile(), attachedArtifact, localRepository );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,10 +36,9 @@ import java.util.Properties;
|
||||||
/**
|
/**
|
||||||
* Resolves user-specified artifacts. This mimics in part the Maven Dependency Plugin and the Maven Surefire Plugin.
|
* Resolves user-specified artifacts. This mimics in part the Maven Dependency Plugin and the Maven Surefire Plugin.
|
||||||
*
|
*
|
||||||
* @goal resolve
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal resolve
|
||||||
*/
|
*/
|
||||||
public class ResolveMojo
|
public class ResolveMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -107,10 +106,8 @@ public class ResolveMojo
|
||||||
{
|
{
|
||||||
if ( dependencies != null )
|
if ( dependencies != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dependencies.length; i++ )
|
for ( Dependency dependency : dependencies )
|
||||||
{
|
{
|
||||||
Dependency dependency = dependencies[i];
|
|
||||||
|
|
||||||
Artifact artifact =
|
Artifact artifact =
|
||||||
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
||||||
dependency.getVersion(), dependency.getType(),
|
dependency.getVersion(), dependency.getType(),
|
||||||
|
@ -142,15 +139,10 @@ public class ResolveMojo
|
||||||
{
|
{
|
||||||
propertiesFile.getParentFile().mkdirs();
|
propertiesFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream( propertiesFile );
|
try ( FileOutputStream fos = new FileOutputStream( propertiesFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( fos, "MAVEN-CORE-IT" );
|
props.store( fos, "MAVEN-CORE-IT" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
fos.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,7 +31,6 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -41,9 +40,8 @@ import java.util.Set;
|
||||||
* Resolves user-specified artifacts transitively. As an additional exercise, the resolution happens in a forked thread
|
* Resolves user-specified artifacts transitively. As an additional exercise, the resolution happens in a forked thread
|
||||||
* to test access to any shared session state.
|
* to test access to any shared session state.
|
||||||
*
|
*
|
||||||
* @goal resolve-transitive
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
* @goal resolve-transitive
|
||||||
*/
|
*/
|
||||||
public class ResolveTransitiveMojo
|
public class ResolveTransitiveMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -140,15 +138,10 @@ public class ResolveTransitiveMojo
|
||||||
{
|
{
|
||||||
propertiesFile.getParentFile().mkdirs();
|
propertiesFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
FileOutputStream fos = new FileOutputStream( propertiesFile );
|
try ( FileOutputStream fos = new FileOutputStream( propertiesFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
thread.props.store( fos, "MAVEN-CORE-IT" );
|
thread.props.store( fos, "MAVEN-CORE-IT" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
fos.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
@ -179,30 +172,27 @@ public class ResolveTransitiveMojo
|
||||||
{
|
{
|
||||||
Set artifacts = new LinkedHashSet();
|
Set artifacts = new LinkedHashSet();
|
||||||
|
|
||||||
for ( int i = 0; i < dependencies.length; i++ )
|
for ( Dependency dependency : dependencies )
|
||||||
{
|
{
|
||||||
Dependency dependency = dependencies[i];
|
|
||||||
|
|
||||||
Artifact artifact =
|
Artifact artifact =
|
||||||
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
||||||
dependency.getVersion(), dependency.getType(),
|
dependency.getVersion(), dependency.getType(),
|
||||||
dependency.getClassifier() );
|
dependency.getClassifier() );
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Resolving "
|
getLog().info(
|
||||||
+ ResolveTransitiveMojo.this.getId( artifact ) );
|
"[MAVEN-CORE-IT-LOG] Resolving " + ResolveTransitiveMojo.this.getId( artifact ) );
|
||||||
|
|
||||||
artifacts.add( artifact );
|
artifacts.add( artifact );
|
||||||
}
|
}
|
||||||
|
|
||||||
Artifact origin = factory.createArtifact( "it", "it", "0.1", null, "pom" );
|
Artifact origin = factory.createArtifact( "it", "it", "0.1", null, "pom" );
|
||||||
|
|
||||||
artifacts =
|
artifacts = resolver.resolveTransitively( artifacts, origin, remoteRepositories, localRepository,
|
||||||
resolver.resolveTransitively( artifacts, origin, remoteRepositories, localRepository,
|
|
||||||
metadataSource ).getArtifacts();
|
metadataSource ).getArtifacts();
|
||||||
|
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Object artifact1 : artifacts )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) artifact1;
|
||||||
|
|
||||||
if ( artifact.getFile() != null )
|
if ( artifact.getFile() != null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,6 @@ import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -94,9 +93,8 @@ public abstract class AbstractLoadMojo
|
||||||
if ( classNames != null && classNames.length() > 0 )
|
if ( classNames != null && classNames.length() > 0 )
|
||||||
{
|
{
|
||||||
String[] names = classNames.split( "," );
|
String[] names = classNames.split( "," );
|
||||||
for ( int i = 0; i < names.length; i++ )
|
for ( String name : names )
|
||||||
{
|
{
|
||||||
String name = names[i];
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + name );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + name );
|
||||||
|
|
||||||
// test ClassLoader.loadClass(String) and (indirectly) ClassLoader.loadClass(String, boolean)
|
// test ClassLoader.loadClass(String) and (indirectly) ClassLoader.loadClass(String, boolean)
|
||||||
|
@ -120,22 +118,22 @@ public abstract class AbstractLoadMojo
|
||||||
|
|
||||||
Method[] methods = type.getDeclaredMethods();
|
Method[] methods = type.getDeclaredMethods();
|
||||||
List methodNames = new ArrayList();
|
List methodNames = new ArrayList();
|
||||||
for ( int j = 0; j < methods.length; j++ )
|
for ( Method method : methods )
|
||||||
{
|
{
|
||||||
if ( Modifier.isPublic( methods[j].getModifiers() ) )
|
if ( Modifier.isPublic( method.getModifiers() ) )
|
||||||
{
|
{
|
||||||
methodNames.add( methods[j].getName() );
|
methodNames.add( method.getName() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collections.sort( methodNames );
|
Collections.sort( methodNames );
|
||||||
StringBuffer buffer = new StringBuffer( 1024 );
|
StringBuilder buffer = new StringBuilder( 1024 );
|
||||||
for ( Iterator it = methodNames.iterator(); it.hasNext(); )
|
for ( Object methodName : methodNames )
|
||||||
{
|
{
|
||||||
if ( buffer.length() > 0 )
|
if ( buffer.length() > 0 )
|
||||||
{
|
{
|
||||||
buffer.append( ',' );
|
buffer.append( ',' );
|
||||||
}
|
}
|
||||||
buffer.append( it.next() );
|
buffer.append( methodName );
|
||||||
}
|
}
|
||||||
|
|
||||||
loaderProperties.setProperty( name + ".methods", buffer.toString() );
|
loaderProperties.setProperty( name + ".methods", buffer.toString() );
|
||||||
|
@ -156,9 +154,8 @@ public abstract class AbstractLoadMojo
|
||||||
if ( resourcePaths != null && resourcePaths.length() > 0 )
|
if ( resourcePaths != null && resourcePaths.length() > 0 )
|
||||||
{
|
{
|
||||||
String[] paths = resourcePaths.split( "," );
|
String[] paths = resourcePaths.split( "," );
|
||||||
for ( int i = 0; i < paths.length; i++ )
|
for ( String path : paths )
|
||||||
{
|
{
|
||||||
String path = paths[i];
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path );
|
||||||
|
|
||||||
// test ClassLoader.getResource()
|
// test ClassLoader.getResource()
|
||||||
|
|
|
@ -30,10 +30,9 @@ import java.util.Properties;
|
||||||
* Checks whether API classes exported by the Maven core are assignment-compatible with types loaded from the plugin
|
* Checks whether API classes exported by the Maven core are assignment-compatible with types loaded from the plugin
|
||||||
* class loader. In other words, checks that types shared with the core realm are imported into the plugin realm.
|
* class loader. In other words, checks that types shared with the core realm are imported into the plugin realm.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
* @goal assignment-compatible
|
* @goal assignment-compatible
|
||||||
* @phase initialize
|
* @phase initialize
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
*/
|
*/
|
||||||
public class AssignmentCompatibleMojo
|
public class AssignmentCompatibleMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -73,9 +72,8 @@ public class AssignmentCompatibleMojo
|
||||||
|
|
||||||
if ( classNames != null )
|
if ( classNames != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < classNames.length; i++ )
|
for ( String className : classNames )
|
||||||
{
|
{
|
||||||
String className = classNames[i];
|
|
||||||
String result;
|
String result;
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + className );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loading class " + className );
|
||||||
|
|
|
@ -54,7 +54,8 @@ class ExpressionUtil
|
||||||
* project.
|
* project.
|
||||||
*
|
*
|
||||||
* @param expression The expression to evaluate, may be <code>null</code>.
|
* @param expression The expression to evaluate, may be <code>null</code>.
|
||||||
* @param contexts The possible root objects for the expression evaluation, indexed by their identifying token, must
|
* @param contexts The possible root objects for the expression evaluation, indexed by their identifying token,
|
||||||
|
* must
|
||||||
* not be <code>null</code>.
|
* not be <code>null</code>.
|
||||||
* @return The value of the expression or <code>null</code> if the expression could not be evaluated.
|
* @return The value of the expression or <code>null</code> if the expression could not be evaluated.
|
||||||
*/
|
*/
|
||||||
|
@ -205,7 +206,7 @@ class ExpressionUtil
|
||||||
{
|
{
|
||||||
if ( "length".equals( property ) && type.isArray() )
|
if ( "length".equals( property ) && type.isArray() )
|
||||||
{
|
{
|
||||||
value = new Integer( Array.getLength( context ) );
|
value = Array.getLength( context );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@ import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -34,11 +33,10 @@ import java.util.Properties;
|
||||||
* Checks whether objects obtained from the Maven core are assignment-compatible with types loaded from the plugin class
|
* Checks whether objects obtained from the Maven core are assignment-compatible with types loaded from the plugin class
|
||||||
* loader. In other words, checks that types shared with the core realm are imported into the plugin realm.
|
* loader. In other words, checks that types shared with the core realm are imported into the plugin realm.
|
||||||
*
|
*
|
||||||
* @goal instanceof
|
|
||||||
* @phase initialize
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal instanceof
|
||||||
|
* @phase initialize
|
||||||
*/
|
*/
|
||||||
public class InstanceofMojo
|
public class InstanceofMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -109,9 +107,8 @@ public class InstanceofMojo
|
||||||
contexts.put( "project", project );
|
contexts.put( "project", project );
|
||||||
contexts.put( "pom", project );
|
contexts.put( "pom", project );
|
||||||
|
|
||||||
for ( int i = 0; i < objectExpressions.length; i++ )
|
for ( String expression : objectExpressions )
|
||||||
{
|
{
|
||||||
String expression = objectExpressions[i];
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Evaluating expression " + expression );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Evaluating expression " + expression );
|
||||||
Object object = ExpressionUtil.evaluate( expression, contexts );
|
Object object = ExpressionUtil.evaluate( expression, contexts );
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Checking object " + object );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Checking object " + object );
|
||||||
|
@ -127,9 +124,8 @@ public class InstanceofMojo
|
||||||
|
|
||||||
if ( components != null && !components.isEmpty() )
|
if ( components != null && !components.isEmpty() )
|
||||||
{
|
{
|
||||||
for ( Iterator it = components.iterator(); it.hasNext(); )
|
for ( Object object : components )
|
||||||
{
|
{
|
||||||
Object object = it.next();
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Checking component " + object );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Checking component " + object );
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class " + object.getClass().getName() );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class " + object.getClass().getName() );
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + object.getClass().getClassLoader() );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loaded class from " + object.getClass().getClassLoader() );
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -54,20 +54,20 @@ public class ExpressionUtilTest
|
||||||
assertSame( bean, ExpressionUtil.evaluate( "bean", contexts ) );
|
assertSame( bean, ExpressionUtil.evaluate( "bean", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "no-root", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "no-root", contexts ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 3 ), ExpressionUtil.evaluate( "array/length", contexts ) );
|
assertEquals( 3, ExpressionUtil.evaluate( "array/length", contexts ) );
|
||||||
assertEquals( "three", ExpressionUtil.evaluate( "array/2", contexts ) );
|
assertEquals( "three", ExpressionUtil.evaluate( "array/2", contexts ) );
|
||||||
assertEquals( new Integer( 5 ), ExpressionUtil.evaluate( "array/2/length", contexts ) );
|
assertEquals( 5, ExpressionUtil.evaluate( "array/2/length", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "array/invalid", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "array/invalid", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "array/-1", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "array/-1", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "array/999", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "array/999", contexts ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 3 ), ExpressionUtil.evaluate( "list/size", contexts ) );
|
assertEquals( 3, ExpressionUtil.evaluate( "list/size", contexts ) );
|
||||||
assertEquals( "-2", ExpressionUtil.evaluate( "list/2", contexts ) );
|
assertEquals( "-2", ExpressionUtil.evaluate( "list/2", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "list/invalid", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "list/invalid", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "list/-1", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "list/-1", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "list/999", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "list/999", contexts ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 1 ), ExpressionUtil.evaluate( "map/size", contexts ) );
|
assertEquals( 1, ExpressionUtil.evaluate( "map/size", contexts ) );
|
||||||
assertEquals( "value", ExpressionUtil.evaluate( "map/some.key", contexts ) );
|
assertEquals( "value", ExpressionUtil.evaluate( "map/some.key", contexts ) );
|
||||||
assertNull( ExpressionUtil.evaluate( "map/invalid", contexts ) );
|
assertNull( ExpressionUtil.evaluate( "map/invalid", contexts ) );
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public class ExpressionUtilTest
|
||||||
assertEquals( bean2.field, ExpressionUtil.getProperty( bean2, "field" ) );
|
assertEquals( bean2.field, ExpressionUtil.getProperty( bean2, "field" ) );
|
||||||
assertSame( bean2.bean, ExpressionUtil.getProperty( bean2, "bean" ) );
|
assertSame( bean2.bean, ExpressionUtil.getProperty( bean2, "bean" ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 0 ), ExpressionUtil.getProperty( new String[0], "length" ) );
|
assertEquals( 0, ExpressionUtil.getProperty( new String[0], "length" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BeanOne
|
public static class BeanOne
|
||||||
|
|
|
@ -19,6 +19,10 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
@ -28,18 +32,13 @@ import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dumps this mojo's configuration into a properties file.
|
* Dumps this mojo's configuration into a properties file.
|
||||||
*
|
*
|
||||||
* @goal config
|
|
||||||
* @phase validate
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal config
|
||||||
|
* @phase validate
|
||||||
*/
|
*/
|
||||||
public class ConfigMojo
|
public class ConfigMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -306,14 +305,14 @@ public class ConfigMojo
|
||||||
PropertiesUtil.serialize( props, "booleanParam", booleanParam );
|
PropertiesUtil.serialize( props, "booleanParam", booleanParam );
|
||||||
if ( primitiveBooleanParam )
|
if ( primitiveBooleanParam )
|
||||||
{
|
{
|
||||||
PropertiesUtil.serialize( props, "primitiveBooleanParam", Boolean.valueOf( primitiveBooleanParam ) );
|
PropertiesUtil.serialize( props, "primitiveBooleanParam", primitiveBooleanParam );
|
||||||
}
|
}
|
||||||
PropertiesUtil.serialize( props, "byteParam", byteParam );
|
PropertiesUtil.serialize( props, "byteParam", byteParam );
|
||||||
PropertiesUtil.serialize( props, "shortParam", shortParam );
|
PropertiesUtil.serialize( props, "shortParam", shortParam );
|
||||||
PropertiesUtil.serialize( props, "integerParam", integerParam );
|
PropertiesUtil.serialize( props, "integerParam", integerParam );
|
||||||
if ( primitiveIntegerParam != 0 )
|
if ( primitiveIntegerParam != 0 )
|
||||||
{
|
{
|
||||||
PropertiesUtil.serialize( props, "primitiveIntegerParam", new Integer( primitiveIntegerParam ) );
|
PropertiesUtil.serialize( props, "primitiveIntegerParam", primitiveIntegerParam );
|
||||||
}
|
}
|
||||||
PropertiesUtil.serialize( props, "longParam", longParam );
|
PropertiesUtil.serialize( props, "longParam", longParam );
|
||||||
PropertiesUtil.serialize( props, "floatParam", floatParam );
|
PropertiesUtil.serialize( props, "floatParam", floatParam );
|
||||||
|
@ -336,7 +335,7 @@ public class ConfigMojo
|
||||||
{
|
{
|
||||||
PropertiesUtil.serialize( props, "beanParam.fieldParam", beanParam.fieldParam );
|
PropertiesUtil.serialize( props, "beanParam.fieldParam", beanParam.fieldParam );
|
||||||
PropertiesUtil.serialize( props, "beanParam.setterParam", beanParam.setterParam );
|
PropertiesUtil.serialize( props, "beanParam.setterParam", beanParam.setterParam );
|
||||||
PropertiesUtil.serialize( props, "beanParam.setterCalled", Boolean.valueOf( beanParam.setterCalled ) );
|
PropertiesUtil.serialize( props, "beanParam.setterCalled", beanParam.setterCalled );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
@ -34,9 +37,6 @@ import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
import org.codehaus.plexus.configuration.PlexusConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assists in handling properties.
|
* Assists in handling properties.
|
||||||
*
|
*
|
||||||
|
@ -164,18 +164,17 @@ class PropertiesUtil
|
||||||
|
|
||||||
PlexusConfiguration children[] = config.getChildren();
|
PlexusConfiguration children[] = config.getChildren();
|
||||||
props.setProperty( key + ".children", Integer.toString( children.length ) );
|
props.setProperty( key + ".children", Integer.toString( children.length ) );
|
||||||
Map indices = new HashMap();
|
Map<String, Integer> indices = new HashMap<>();
|
||||||
for ( int i = 0; i < children.length; i++ )
|
for ( PlexusConfiguration child : children )
|
||||||
{
|
{
|
||||||
PlexusConfiguration child = children[i];
|
|
||||||
String name = child.getName();
|
String name = child.getName();
|
||||||
Integer index = (Integer) indices.get( name );
|
Integer index = indices.get( name );
|
||||||
if ( index == null )
|
if ( index == null )
|
||||||
{
|
{
|
||||||
index = new Integer( 0 );
|
index = 0;
|
||||||
}
|
}
|
||||||
serialize( props, key + ".children." + name + "." + index, child );
|
serialize( props, key + ".children." + name + "." + index, child );
|
||||||
indices.put( name, new Integer( index.intValue() + 1 ) );
|
indices.put( name, index + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( value instanceof Date )
|
else if ( value instanceof Date )
|
||||||
|
|
|
@ -32,11 +32,10 @@ import java.io.OutputStreamWriter;
|
||||||
/**
|
/**
|
||||||
* Creates a text file in the project base directory.
|
* Creates a text file in the project base directory.
|
||||||
*
|
*
|
||||||
* @goal resources
|
|
||||||
* @phase process-resources
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal resources
|
||||||
|
* @phase process-resources
|
||||||
*/
|
*/
|
||||||
public class ResourcesMojo
|
public class ResourcesMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -98,16 +97,12 @@ public class ResourcesMojo
|
||||||
{
|
{
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + message );
|
getLog().info( "[MAVEN-CORE-IT-LOG] " + message );
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ), "UTF-8" );
|
try ( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ),
|
||||||
try
|
"UTF-8" ) )
|
||||||
{
|
{
|
||||||
writer.write( message );
|
writer.write( message );
|
||||||
writer.write( "\n" );
|
writer.write( "\n" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,6 @@ import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStreamWriter;
|
import java.io.OutputStreamWriter;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides common services for all mojos of this plugin.
|
* Provides common services for all mojos of this plugin.
|
||||||
|
@ -80,9 +79,9 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
if ( artifacts != null )
|
if ( artifacts != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Object artifact1 : artifacts )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) artifact1;
|
||||||
writer.write( artifact.getId() );
|
writer.write( artifact.getId() );
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() );
|
getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() );
|
||||||
|
|
|
@ -19,24 +19,22 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines dependency collection with aggregation. The path parameters of this mojo support the token
|
* Combines dependency collection with aggregation. The path parameters of this mojo support the token
|
||||||
* <code>@artifactId@</code> to dynamically adjust the output file for each project in the reactor whose
|
* <code>@artifactId@</code> to dynamically adjust the output file for each project in the reactor whose
|
||||||
* dependencies are dumped.
|
* dependencies are dumped.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
|
* @version $Id$
|
||||||
* @goal aggregate-test
|
* @goal aggregate-test
|
||||||
* @requiresDependencyCollection test
|
* @requiresDependencyCollection test
|
||||||
* @aggregator true
|
* @aggregator true
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class AggregateTestMojo
|
public class AggregateTestMojo
|
||||||
extends AbstractDependencyMojo
|
extends AbstractDependencyMojo
|
||||||
|
@ -70,9 +68,9 @@ public class AggregateTestMojo
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
|
for ( Object reactorProject : reactorProjects )
|
||||||
{
|
{
|
||||||
MavenProject project = (MavenProject) it.next();
|
MavenProject project = (MavenProject) reactorProject;
|
||||||
|
|
||||||
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
|
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import java.security.DigestInputStream;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,9 +95,9 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
if ( artifacts != null )
|
if ( artifacts != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = artifacts.iterator(); it.hasNext(); )
|
for ( Object artifact1 : artifacts )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) artifact1;
|
||||||
String id = getId( artifact );
|
String id = getId( artifact );
|
||||||
writer.write( id );
|
writer.write( id );
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
|
@ -161,9 +160,9 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
if ( classPath != null )
|
if ( classPath != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = classPath.iterator(); it.hasNext(); )
|
for ( Object aClassPath : classPath )
|
||||||
{
|
{
|
||||||
String element = it.next().toString();
|
String element = aClassPath.toString();
|
||||||
writer.write( stripLeadingDirs( element, significantPathLevels ) );
|
writer.write( stripLeadingDirs( element, significantPathLevels ) );
|
||||||
writer.newLine();
|
writer.newLine();
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + element );
|
getLog().info( "[MAVEN-CORE-IT-LOG] " + element );
|
||||||
|
@ -206,9 +205,9 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
if ( classPath != null )
|
if ( classPath != null )
|
||||||
{
|
{
|
||||||
for ( Iterator it = classPath.iterator(); it.hasNext(); )
|
for ( Object aClassPath : classPath )
|
||||||
{
|
{
|
||||||
String element = it.next().toString();
|
String element = aClassPath.toString();
|
||||||
|
|
||||||
File jarFile = new File( element );
|
File jarFile = new File( element );
|
||||||
|
|
||||||
|
@ -274,8 +273,7 @@ public abstract class AbstractDependencyMojo
|
||||||
{
|
{
|
||||||
MessageDigest digester = MessageDigest.getInstance( "SHA-1" );
|
MessageDigest digester = MessageDigest.getInstance( "SHA-1" );
|
||||||
|
|
||||||
FileInputStream is = new FileInputStream( jarFile );
|
try ( FileInputStream is = new FileInputStream( jarFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
DigestInputStream dis = new DigestInputStream( is, digester );
|
DigestInputStream dis = new DigestInputStream( is, digester );
|
||||||
|
|
||||||
|
@ -284,19 +282,14 @@ public abstract class AbstractDependencyMojo
|
||||||
// just read it
|
// just read it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
is.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] digest = digester.digest();
|
byte[] digest = digester.digest();
|
||||||
|
|
||||||
StringBuffer hash = new StringBuffer( digest.length * 2 );
|
StringBuilder hash = new StringBuilder( digest.length * 2 );
|
||||||
|
|
||||||
for ( int i = 0; i < digest.length; i++ )
|
for ( byte aDigest : digest )
|
||||||
{
|
{
|
||||||
@SuppressWarnings( "checkstyle:magicnumber" )
|
@SuppressWarnings( "checkstyle:magicnumber" ) int b = aDigest & 0xFF;
|
||||||
int b = digest[i] & 0xFF;
|
|
||||||
|
|
||||||
if ( b < 0x10 )
|
if ( b < 0x10 )
|
||||||
{
|
{
|
||||||
|
@ -341,7 +334,7 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
if ( pathname != null )
|
if ( pathname != null )
|
||||||
{
|
{
|
||||||
if ( pathname.indexOf( "@idx@" ) >= 0 )
|
if ( pathname.contains( "@idx@" ) )
|
||||||
{
|
{
|
||||||
// helps to distinguished forked executions of the same mojo
|
// helps to distinguished forked executions of the same mojo
|
||||||
pathname = pathname.replaceAll( "@idx@", String.valueOf( nextCounter() ) );
|
pathname = pathname.replaceAll( "@idx@", String.valueOf( nextCounter() ) );
|
||||||
|
@ -366,7 +359,7 @@ public abstract class AbstractDependencyMojo
|
||||||
|
|
||||||
synchronized ( System.class )
|
synchronized ( System.class )
|
||||||
{
|
{
|
||||||
counter = Integer.getInteger( key, 0 ).intValue();
|
counter = Integer.getInteger( key, 0 );
|
||||||
System.setProperty( key, Integer.toString( counter + 1 ) );
|
System.setProperty( key, Integer.toString( counter + 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,24 +19,22 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combines dependency resolution with aggregation. The path parameters of this mojo support the token
|
* Combines dependency resolution with aggregation. The path parameters of this mojo support the token
|
||||||
* <code>@artifactId@</code> to dynamically adjust the output file for each project in the reactor whose
|
* <code>@artifactId@</code> to dynamically adjust the output file for each project in the reactor whose
|
||||||
* dependencies are dumped.
|
* dependencies are dumped.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
|
* @version $Id$
|
||||||
* @goal aggregate-test
|
* @goal aggregate-test
|
||||||
* @requiresDependencyResolution test
|
* @requiresDependencyResolution test
|
||||||
* @aggregator true
|
* @aggregator true
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class AggregateTestMojo
|
public class AggregateTestMojo
|
||||||
extends AbstractDependencyMojo
|
extends AbstractDependencyMojo
|
||||||
|
@ -88,9 +86,9 @@ public class AggregateTestMojo
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
|
for ( Object reactorProject : reactorProjects )
|
||||||
{
|
{
|
||||||
MavenProject project = (MavenProject) it.next();
|
MavenProject project = (MavenProject) reactorProject;
|
||||||
|
|
||||||
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
|
writeArtifacts( filter( projectArtifacts, project ), project.getArtifacts() );
|
||||||
writeClassPath( filter( testClassPath, project ), project.getTestClasspathElements() );
|
writeClassPath( filter( testClassPath, project ), project.getTestClasspathElements() );
|
||||||
|
|
|
@ -19,25 +19,23 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Injects artifacts from the plugin into the dependency artifacts of the project.
|
* Injects artifacts from the plugin into the dependency artifacts of the project.
|
||||||
*
|
*
|
||||||
* @goal inject
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal inject
|
||||||
*/
|
*/
|
||||||
public class InjectMojo
|
public class InjectMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -99,16 +97,17 @@ public class InjectMojo
|
||||||
dependencyArtifacts = new LinkedHashSet();
|
dependencyArtifacts = new LinkedHashSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator it = pluginArtifacts.iterator(); it.hasNext(); )
|
for ( Object pluginArtifact : pluginArtifacts )
|
||||||
{
|
{
|
||||||
Artifact artifact = (Artifact) it.next();
|
Artifact artifact = (Artifact) pluginArtifact;
|
||||||
|
|
||||||
String artifactKey = artifact.getGroupId() + ':' + artifact.getArtifactId();
|
String artifactKey = artifact.getGroupId() + ':' + artifact.getArtifactId();
|
||||||
|
|
||||||
if ( artifactKeys.remove( artifactKey ) )
|
if ( artifactKeys.remove( artifactKey ) )
|
||||||
{
|
{
|
||||||
artifact = factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(),
|
artifact =
|
||||||
artifact.getVersion(), Artifact.SCOPE_COMPILE, artifact.getType() );
|
factory.createArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(),
|
||||||
|
Artifact.SCOPE_COMPILE, artifact.getType() );
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Injecting dependency artifact " + artifact );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Injecting dependency artifact " + artifact );
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,6 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.apache.maven.artifact.Artifact;
|
import org.apache.maven.artifact.Artifact;
|
||||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||||
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
|
||||||
|
@ -36,13 +31,17 @@ import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to resolve a single artifact from dependencies, and logs the results for the Verifier to look at.
|
* Attempts to resolve a single artifact from dependencies, and logs the results for the Verifier to look at.
|
||||||
*
|
*
|
||||||
* @goal resolve-one-dependency
|
|
||||||
* @requiresDependencyResolution runtime
|
|
||||||
* @author bimargulies
|
* @author bimargulies
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal resolve-one-dependency
|
||||||
|
* @requiresDependencyResolution runtime
|
||||||
*/
|
*/
|
||||||
public class ResolveOneDependencyMojo
|
public class ResolveOneDependencyMojo
|
||||||
extends AbstractDependencyMojo
|
extends AbstractDependencyMojo
|
||||||
|
@ -55,6 +54,7 @@ public class ResolveOneDependencyMojo
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
private String groupId;
|
private String groupId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Artifact ID of the artifact to resolve.
|
* Artifact ID of the artifact to resolve.
|
||||||
*
|
*
|
||||||
|
@ -62,6 +62,7 @@ public class ResolveOneDependencyMojo
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
private String artifactId;
|
private String artifactId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version of the artifact to resolve.
|
* Version of the artifact to resolve.
|
||||||
*
|
*
|
||||||
|
@ -69,6 +70,7 @@ public class ResolveOneDependencyMojo
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
private String version;
|
private String version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of the artifact to resolve.
|
* Type of the artifact to resolve.
|
||||||
*
|
*
|
||||||
|
@ -76,6 +78,7 @@ public class ResolveOneDependencyMojo
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classifier of the artifact to resolve.
|
* Classifier of the artifact to resolve.
|
||||||
*
|
*
|
||||||
|
@ -137,8 +140,7 @@ public class ResolveOneDependencyMojo
|
||||||
Artifact projectArtifact = project.getArtifact();
|
Artifact projectArtifact = project.getArtifact();
|
||||||
if ( projectArtifact == null )
|
if ( projectArtifact == null )
|
||||||
{
|
{
|
||||||
projectArtifact =
|
projectArtifact = artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
|
||||||
artifactFactory.createProjectArtifact( project.getGroupId(), project.getArtifactId(),
|
|
||||||
project.getVersion() );
|
project.getVersion() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,10 +154,10 @@ public class ResolveOneDependencyMojo
|
||||||
ArtifactResolutionResult result;
|
ArtifactResolutionResult result;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
result =
|
result = resolver.resolveTransitively( depArtifacts, projectArtifact, project.getManagedVersionMap(),
|
||||||
resolver.resolveTransitively( depArtifacts, projectArtifact, project.getManagedVersionMap(),
|
session.getLocalRepository(),
|
||||||
session.getLocalRepository(), project.getRemoteArtifactRepositories(),
|
project.getRemoteArtifactRepositories(), metadataSource,
|
||||||
metadataSource, scopeFilter );
|
scopeFilter );
|
||||||
}
|
}
|
||||||
catch ( ArtifactResolutionException e )
|
catch ( ArtifactResolutionException e )
|
||||||
{
|
{
|
||||||
|
@ -173,13 +175,12 @@ public class ResolveOneDependencyMojo
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Set resolvedArtifacts = result.getArtifacts();
|
Set resolvedArtifacts = result.getArtifacts();
|
||||||
Iterator it = resolvedArtifacts.iterator();
|
|
||||||
/*
|
/*
|
||||||
* Assume that the user of this is not interested in transitive deps and such, just report the one.
|
* Assume that the user of this is not interested in transitive deps and such, just report the one.
|
||||||
*/
|
*/
|
||||||
while ( it.hasNext() )
|
for ( Object resolvedArtifact : resolvedArtifacts )
|
||||||
{
|
{
|
||||||
Artifact a = (Artifact) it.next();
|
Artifact a = (Artifact) resolvedArtifact;
|
||||||
if ( a.equals( artifact ) )
|
if ( a.equals( artifact ) )
|
||||||
{
|
{
|
||||||
File file = a.getFile();
|
File file = a.getFile();
|
||||||
|
|
|
@ -26,7 +26,6 @@ import org.apache.maven.plugin.MojoFailureException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ import java.util.Properties;
|
||||||
* value but can also be a collection/array or a bean-like object (from the Maven model). For example, the expression
|
* value but can also be a collection/array or a bean-like object (from the Maven model). For example, the expression
|
||||||
* "project/dependencies/0" would extract the first project dependency. In more detail, this example expression could
|
* "project/dependencies/0" would extract the first project dependency. In more detail, this example expression could
|
||||||
* output the following keys to the properties file:
|
* output the following keys to the properties file:
|
||||||
*
|
* <p/>
|
||||||
* <pre>
|
* <pre>
|
||||||
* project.dependencies.0.groupId = org.apache.maven
|
* project.dependencies.0.groupId = org.apache.maven
|
||||||
* project.dependencies.0.artifactId = maven-project
|
* project.dependencies.0.artifactId = maven-project
|
||||||
|
@ -50,15 +49,14 @@ import java.util.Properties;
|
||||||
* project.dependencies.0.exclusions.1.groupId = plexus
|
* project.dependencies.0.exclusions.1.groupId = plexus
|
||||||
* project.dependencies.0.exclusions.1.artifactId = plexus-container-default
|
* project.dependencies.0.exclusions.1.artifactId = plexus-container-default
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
* <p/>
|
||||||
* Expressions that reference non-existing objects or use invalid collection/array indices silently resolve to
|
* Expressions that reference non-existing objects or use invalid collection/array indices silently resolve to
|
||||||
* <code>null</code>. For collections and arrays, the special index "*" can be used to iterate all elements.
|
* <code>null</code>. For collections and arrays, the special index "*" can be used to iterate all elements.
|
||||||
*
|
*
|
||||||
* @goal eval
|
|
||||||
* @phase initialize
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal eval
|
||||||
|
* @phase initialize
|
||||||
*/
|
*/
|
||||||
public class EvalMojo
|
public class EvalMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -175,12 +173,11 @@ public class EvalMojo
|
||||||
contexts.put( "session", session );
|
contexts.put( "session", session );
|
||||||
contexts.put( "localRepository", localRepository );
|
contexts.put( "localRepository", localRepository );
|
||||||
|
|
||||||
for ( int i = 0; i < expressions.length; i++ )
|
for ( String expression : expressions )
|
||||||
{
|
{
|
||||||
Map values = ExpressionUtil.evaluate( expressions[i], contexts );
|
Map values = ExpressionUtil.evaluate( expression, contexts );
|
||||||
for ( Iterator it = values.keySet().iterator(); it.hasNext(); )
|
for ( Object key : values.keySet() )
|
||||||
{
|
{
|
||||||
Object key = it.next();
|
|
||||||
Object value = values.get( key );
|
Object value = values.get( key );
|
||||||
PropertyUtil.store( expressionProperties, key.toString().replace( '/', '.' ), value );
|
PropertyUtil.store( expressionProperties, key.toString().replace( '/', '.' ), value );
|
||||||
}
|
}
|
||||||
|
|
|
@ -142,12 +142,12 @@ class ExpressionUtil
|
||||||
}
|
}
|
||||||
|
|
||||||
values = new LinkedHashMap();
|
values = new LinkedHashMap();
|
||||||
for ( Iterator it = targets.keySet().iterator(); it.hasNext(); )
|
for ( Object key : targets.keySet() )
|
||||||
{
|
{
|
||||||
Object key = it.next();
|
|
||||||
Object target = targets.get( key );
|
Object target = targets.get( key );
|
||||||
values.putAll( evaluate( concat( prefix, String.valueOf( key ) ),
|
values.putAll(
|
||||||
segments.subList( 1, segments.size() ), target ) );
|
evaluate( concat( prefix, String.valueOf( key ) ), segments.subList( 1, segments.size() ),
|
||||||
|
target ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ class ExpressionUtil
|
||||||
{
|
{
|
||||||
if ( "length".equals( property ) && type.isArray() )
|
if ( "length".equals( property ) && type.isArray() )
|
||||||
{
|
{
|
||||||
value = new Integer( Array.getLength( context ) );
|
value = Array.getLength( context );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -132,21 +132,19 @@ class PropertyUtil
|
||||||
props.put( key + ".children", Integer.toString( children.length ) );
|
props.put( key + ".children", Integer.toString( children.length ) );
|
||||||
|
|
||||||
Map indices = new HashMap();
|
Map indices = new HashMap();
|
||||||
for ( int i = 0; i < children.length; i++ )
|
for ( Object child : children )
|
||||||
{
|
{
|
||||||
Object child = children[i];
|
|
||||||
|
|
||||||
String name = (String) getName.invoke( child, NO_ARGS );
|
String name = (String) getName.invoke( child, NO_ARGS );
|
||||||
|
|
||||||
Integer index = (Integer) indices.get( name );
|
Integer index = (Integer) indices.get( name );
|
||||||
if ( index == null )
|
if ( index == null )
|
||||||
{
|
{
|
||||||
index = new Integer( 0 );
|
index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
store( props, key + ".children." + name + "." + index, child, visited );
|
store( props, key + ".children." + name + "." + index, child, visited );
|
||||||
|
|
||||||
indices.put( name, new Integer( index.intValue() + 1 ) );
|
indices.put( name, index + 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( Exception e )
|
||||||
|
@ -158,13 +156,12 @@ class PropertyUtil
|
||||||
{
|
{
|
||||||
Class type = obj.getClass();
|
Class type = obj.getClass();
|
||||||
Method[] methods = type.getMethods();
|
Method[] methods = type.getMethods();
|
||||||
for ( int i = 0; i < methods.length; i++ )
|
for ( Method method : methods )
|
||||||
{
|
{
|
||||||
Method method = methods[i];
|
|
||||||
if ( Modifier.isStatic( method.getModifiers() ) || method.getParameterTypes().length > 0
|
if ( Modifier.isStatic( method.getModifiers() ) || method.getParameterTypes().length > 0
|
||||||
|| !method.getName().matches( "(get|is)\\p{Lu}.*" ) || method.getName().endsWith( "AsMap" )
|
|| !method.getName().matches( "(get|is)\\p{Lu}.*" ) || method.getName().endsWith( "AsMap" )
|
||||||
|| Class.class.isAssignableFrom( method.getReturnType() )
|
|| Class.class.isAssignableFrom( method.getReturnType() ) || Object.class.equals(
|
||||||
|| Object.class.equals( method.getReturnType() ) )
|
method.getReturnType() ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -54,9 +54,9 @@ public class ExpressionUtilTest
|
||||||
assertSame( bean, evaluate( "bean", contexts ) );
|
assertSame( bean, evaluate( "bean", contexts ) );
|
||||||
assertNull( evaluate( "no-root", contexts ) );
|
assertNull( evaluate( "no-root", contexts ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 3 ), evaluate( "array/length", contexts ) );
|
assertEquals( 3, evaluate( "array/length", contexts ) );
|
||||||
assertEquals( "three", evaluate( "array/2", contexts ) );
|
assertEquals( "three", evaluate( "array/2", contexts ) );
|
||||||
assertEquals( new Integer( 5 ), evaluate( "array/2/length", contexts ) );
|
assertEquals( 5, evaluate( "array/2/length", contexts ) );
|
||||||
assertNull( evaluate( "array/invalid", contexts ) );
|
assertNull( evaluate( "array/invalid", contexts ) );
|
||||||
assertNull( evaluate( "array/-1", contexts ) );
|
assertNull( evaluate( "array/-1", contexts ) );
|
||||||
assertNull( evaluate( "array/999", contexts ) );
|
assertNull( evaluate( "array/999", contexts ) );
|
||||||
|
@ -65,7 +65,7 @@ public class ExpressionUtilTest
|
||||||
assertEquals( "two", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/1" ) );
|
assertEquals( "two", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/1" ) );
|
||||||
assertEquals( "three", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/2" ) );
|
assertEquals( "three", ExpressionUtil.evaluate( "array/*", contexts ).get( "array/2" ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 3 ), evaluate( "list/size", contexts ) );
|
assertEquals( 3, evaluate( "list/size", contexts ) );
|
||||||
assertEquals( "-2", evaluate( "list/2", contexts ) );
|
assertEquals( "-2", evaluate( "list/2", contexts ) );
|
||||||
assertNull( evaluate( "list/invalid", contexts ) );
|
assertNull( evaluate( "list/invalid", contexts ) );
|
||||||
assertNull( evaluate( "list/-1", contexts ) );
|
assertNull( evaluate( "list/-1", contexts ) );
|
||||||
|
@ -75,7 +75,7 @@ public class ExpressionUtilTest
|
||||||
assertEquals( "-1", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/1" ) );
|
assertEquals( "-1", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/1" ) );
|
||||||
assertEquals( "-2", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/2" ) );
|
assertEquals( "-2", ExpressionUtil.evaluate( "list/*", contexts ).get( "list/2" ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 1 ), evaluate( "map/size", contexts ) );
|
assertEquals( 1, evaluate( "map/size", contexts ) );
|
||||||
assertEquals( "value", evaluate( "map/some.key", contexts ) );
|
assertEquals( "value", evaluate( "map/some.key", contexts ) );
|
||||||
assertNull( evaluate( "map/invalid", contexts ) );
|
assertNull( evaluate( "map/invalid", contexts ) );
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ public class ExpressionUtilTest
|
||||||
assertEquals( bean2.field, ExpressionUtil.getProperty( bean2, "field" ) );
|
assertEquals( bean2.field, ExpressionUtil.getProperty( bean2, "field" ) );
|
||||||
assertSame( bean2.bean, ExpressionUtil.getProperty( bean2, "bean" ) );
|
assertSame( bean2.bean, ExpressionUtil.getProperty( bean2, "bean" ) );
|
||||||
|
|
||||||
assertEquals( new Integer( 0 ), ExpressionUtil.getProperty( new String[0], "length" ) );
|
assertEquals( 0, ExpressionUtil.getProperty( new String[0], "length" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BeanOne
|
public static class BeanOne
|
||||||
|
|
|
@ -19,13 +19,13 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -40,7 +40,7 @@ public class PropertyUtilTest
|
||||||
PropertyUtil.store( props, "null", null );
|
PropertyUtil.store( props, "null", null );
|
||||||
PropertyUtil.store( props, "string", "str" );
|
PropertyUtil.store( props, "string", "str" );
|
||||||
PropertyUtil.store( props, "boolean", Boolean.TRUE );
|
PropertyUtil.store( props, "boolean", Boolean.TRUE );
|
||||||
PropertyUtil.store( props, "int", new Integer( 7 ) );
|
PropertyUtil.store( props, "int", 7 );
|
||||||
PropertyUtil.store( props, "file", new File( "pom.xml" ) );
|
PropertyUtil.store( props, "file", new File( "pom.xml" ) );
|
||||||
|
|
||||||
assertNull( props.get( "null" ) );
|
assertNull( props.get( "null" ) );
|
||||||
|
|
|
@ -19,17 +19,15 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal fork-goal-aggregator
|
* @goal fork-goal-aggregator
|
||||||
* @aggregator true
|
* @aggregator true
|
||||||
*
|
|
||||||
* @execute goal="touch"
|
* @execute goal="touch"
|
||||||
*/
|
*/
|
||||||
public class ForkGoalAggregatorMojo
|
public class ForkGoalAggregatorMojo
|
||||||
|
@ -48,22 +46,23 @@ public class ForkGoalAggregatorMojo
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
|
for ( Object reactorProject : reactorProjects )
|
||||||
{
|
{
|
||||||
MavenProject executedProject = ( (MavenProject) it.next() ).getExecutionProject();
|
MavenProject executedProject = ( (MavenProject) reactorProject ).getExecutionProject();
|
||||||
|
|
||||||
if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "Unexpected result, final name of executed project "
|
throw new MojoExecutionException(
|
||||||
+ executedProject + " is " + executedProject.getBuild().getFinalName() + " (should be \'"
|
"Unexpected result, final name of executed project " + executedProject + " is "
|
||||||
+ TouchMojo.FINAL_NAME + "\')." );
|
+ executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME
|
||||||
|
+ "\')." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME
|
throw new MojoExecutionException(
|
||||||
+ "\')." );
|
"forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,17 +19,15 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal fork-lifecycle-aggregator
|
* @goal fork-lifecycle-aggregator
|
||||||
* @aggregator true
|
* @aggregator true
|
||||||
*
|
|
||||||
* @execute phase="generate-sources" lifecycle="foo"
|
* @execute phase="generate-sources" lifecycle="foo"
|
||||||
*/
|
*/
|
||||||
public class ForkLifecycleAggregatorMojo
|
public class ForkLifecycleAggregatorMojo
|
||||||
|
@ -49,22 +47,23 @@ public class ForkLifecycleAggregatorMojo
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
for ( Iterator it = reactorProjects.iterator(); it.hasNext(); )
|
for ( Object reactorProject : reactorProjects )
|
||||||
{
|
{
|
||||||
MavenProject executedProject = ( (MavenProject) it.next() ).getExecutionProject();
|
MavenProject executedProject = ( (MavenProject) reactorProject ).getExecutionProject();
|
||||||
|
|
||||||
if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "Unexpected result, final name of executed project "
|
throw new MojoExecutionException(
|
||||||
+ executedProject + " is " + executedProject.getBuild().getFinalName() + " (should be \'"
|
"Unexpected result, final name of executed project " + executedProject + " is "
|
||||||
+ TouchMojo.FINAL_NAME + "\')." );
|
+ executedProject.getBuild().getFinalName() + " (should be \'" + TouchMojo.FINAL_NAME
|
||||||
|
+ "\')." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
if ( project.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME
|
throw new MojoExecutionException(
|
||||||
+ "\')." );
|
"forked project was polluted. (should NOT be \'" + TouchMojo.FINAL_NAME + "\')." );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,10 @@ import org.apache.maven.plugin.MojoExecutionException;
|
||||||
/**
|
/**
|
||||||
* Appends a separator line to the log file.
|
* Appends a separator line to the log file.
|
||||||
*
|
*
|
||||||
* @goal log-separator
|
|
||||||
* @phase initialize
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal log-separator
|
||||||
|
* @phase initialize
|
||||||
*/
|
*/
|
||||||
public class LogSeparatorMojo
|
public class LogSeparatorMojo
|
||||||
extends AbstractLogMojo
|
extends AbstractLogMojo
|
||||||
|
@ -49,7 +48,7 @@ public class LogSeparatorMojo
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer( length );
|
StringBuilder buffer = new StringBuilder( length );
|
||||||
for ( int i = 0; i < length; i++ )
|
for ( int i = 0; i < length; i++ )
|
||||||
{
|
{
|
||||||
buffer.append( '-' );
|
buffer.append( '-' );
|
||||||
|
|
|
@ -19,22 +19,21 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requires a component with a non-default role hint and dumps this hint to a properties file.
|
* Requires a component with a non-default role hint and dumps this hint to a properties file.
|
||||||
*
|
*
|
||||||
* @goal it
|
|
||||||
* @phase initialize
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal it
|
||||||
|
* @phase initialize
|
||||||
*/
|
*/
|
||||||
public class ItMojo
|
public class ItMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -72,15 +71,10 @@ public class ItMojo
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
FileOutputStream os = new FileOutputStream( outputFile );
|
try ( FileOutputStream os = new FileOutputStream( outputFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "MAVEN-CORE-IT-LOG" );
|
props.store( os, "MAVEN-CORE-IT-LOG" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,16 +58,12 @@ public class AppendMojo
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] " + message );
|
getLog().info( "[MAVEN-CORE-IT-LOG] " + message );
|
||||||
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ), "UTF-8" );
|
try ( OutputStreamWriter writer = new OutputStreamWriter( new FileOutputStream( outputFile, true ),
|
||||||
try
|
"UTF-8" ) )
|
||||||
{
|
{
|
||||||
writer.write( message );
|
writer.write( message );
|
||||||
writer.write( "\n" );
|
writer.write( "\n" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,14 +19,14 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that we correctly use the implementation parameter.
|
* Check that we correctly use the implementation parameter.
|
||||||
*
|
*
|
||||||
|
@ -69,15 +69,10 @@ public class ParameterImplementationMojo
|
||||||
{
|
{
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
|
|
||||||
FileOutputStream os = new FileOutputStream( outputFile );
|
try ( FileOutputStream os = new FileOutputStream( outputFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "[MAVEN-CORE-IT-LOG]" );
|
props.store( os, "[MAVEN-CORE-IT-LOG]" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,15 +19,15 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal verify-property
|
* @goal verify-property
|
||||||
* @phase validate
|
* @phase validate
|
||||||
|
@ -65,7 +65,7 @@ public class PropertyInterpolationVerifierMojo
|
||||||
throw new MojoExecutionException( "Properties do not match: Name = " + name + ", Value = " + value );
|
throw new MojoExecutionException( "Properties do not match: Name = " + name + ", Value = " + value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( value.indexOf( "${" ) > -1 )
|
if ( value.contains( "${" ) )
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "Unresolved value: Name = " + name + ", Value = " + value );
|
throw new MojoExecutionException( "Unresolved value: Name = " + name + ", Value = " + value );
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,15 +69,10 @@ public abstract class AbstractPomMojo
|
||||||
{
|
{
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
|
|
||||||
FileOutputStream os = new FileOutputStream( file );
|
try ( FileOutputStream os = new FileOutputStream( file ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "[MAVEN-CORE-IT-LOG]" );
|
props.store( os, "[MAVEN-CORE-IT-LOG]" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,8 +29,8 @@ import java.util.Properties;
|
||||||
/**
|
/**
|
||||||
* Builds the local POMs.
|
* Builds the local POMs.
|
||||||
*
|
*
|
||||||
* @goal local-pom
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
|
* @goal local-pom
|
||||||
*/
|
*/
|
||||||
public class BuildLocalPomMojo
|
public class BuildLocalPomMojo
|
||||||
extends AbstractPomMojo
|
extends AbstractPomMojo
|
||||||
|
@ -73,10 +73,8 @@ public class BuildLocalPomMojo
|
||||||
|
|
||||||
if ( files != null )
|
if ( files != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < files.length; i++ )
|
for ( File file : files )
|
||||||
{
|
{
|
||||||
File file = files[i];
|
|
||||||
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Building " + file );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Building " + file );
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -33,10 +33,9 @@ import java.util.Properties;
|
||||||
/**
|
/**
|
||||||
* Builds the remote POMs of user-specified artifacts. This mimics in part the Maven Remote Resources Plugin.
|
* Builds the remote POMs of user-specified artifacts. This mimics in part the Maven Remote Resources Plugin.
|
||||||
*
|
*
|
||||||
* @goal remote-pom
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal remote-pom
|
||||||
*/
|
*/
|
||||||
public class BuildRemotePomMojo
|
public class BuildRemotePomMojo
|
||||||
extends AbstractPomMojo
|
extends AbstractPomMojo
|
||||||
|
@ -95,10 +94,8 @@ public class BuildRemotePomMojo
|
||||||
|
|
||||||
if ( dependencies != null )
|
if ( dependencies != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < dependencies.length; i++ )
|
for ( Dependency dependency : dependencies )
|
||||||
{
|
{
|
||||||
Dependency dependency = dependencies[i];
|
|
||||||
|
|
||||||
Artifact artifact =
|
Artifact artifact =
|
||||||
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
factory.createArtifactWithClassifier( dependency.getGroupId(), dependency.getArtifactId(),
|
||||||
dependency.getVersion(), dependency.getType(),
|
dependency.getVersion(), dependency.getType(),
|
||||||
|
|
|
@ -19,6 +19,9 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -26,17 +29,13 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requires a singleton component in various ways and dumps the ids to a properties file.
|
* Requires a singleton component in various ways and dumps the ids to a properties file.
|
||||||
*
|
*
|
||||||
* @goal it
|
|
||||||
* @phase initialize
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal it
|
||||||
|
* @phase initialize
|
||||||
*/
|
*/
|
||||||
public class ItMojo
|
public class ItMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -104,15 +103,10 @@ public class ItMojo
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
outputFile.getParentFile().mkdirs();
|
outputFile.getParentFile().mkdirs();
|
||||||
FileOutputStream os = new FileOutputStream( outputFile );
|
try ( FileOutputStream os = new FileOutputStream( outputFile ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "MAVEN-CORE-IT-LOG" );
|
props.store( os, "MAVEN-CORE-IT-LOG" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,12 +35,11 @@ import java.util.Locale;
|
||||||
/**
|
/**
|
||||||
* Generates the available/configured reports.
|
* Generates the available/configured reports.
|
||||||
*
|
*
|
||||||
|
* @author Benjamin Bentmann
|
||||||
|
* @version $Id$
|
||||||
* @goal generate
|
* @goal generate
|
||||||
* @phase site
|
* @phase site
|
||||||
* @requiresReports true
|
* @requiresReports true
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class GenerateMojo
|
public class GenerateMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -101,9 +100,9 @@ public class GenerateMojo
|
||||||
};
|
};
|
||||||
Sink sink = (Sink) Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{ Sink.class }, handler );
|
Sink sink = (Sink) Proxy.newProxyInstance( getClass().getClassLoader(), new Class[]{ Sink.class }, handler );
|
||||||
|
|
||||||
for ( int i = 0; i < reports.size(); i++ )
|
for ( Object report1 : reports )
|
||||||
{
|
{
|
||||||
MavenReport report = (MavenReport) reports.get( i );
|
MavenReport report = (MavenReport) report1;
|
||||||
|
|
||||||
if ( report.canGenerateReport() )
|
if ( report.canGenerateReport() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,12 @@ package org.apache.maven.plugin.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.execution.MavenSession;
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.toolchain.ToolchainManagerPrivate;
|
||||||
|
import org.apache.maven.toolchain.ToolchainPrivate;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -29,12 +35,6 @@ import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.execution.MavenSession;
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
|
||||||
import org.apache.maven.toolchain.ToolchainManagerPrivate;
|
|
||||||
import org.apache.maven.toolchain.ToolchainPrivate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal toolchain
|
* @goal toolchain
|
||||||
* @phase validate
|
* @phase validate
|
||||||
|
@ -101,8 +101,8 @@ public class CoreItMojo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getLog().warn( "[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only "
|
getLog().warn(
|
||||||
+ tcs.length );
|
"[MAVEN-CORE-IT-LOG] Toolchain #" + selected + " can't be selected, found only " + tcs.length );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,15 +170,7 @@ public class CoreItMojo
|
||||||
return (ToolchainPrivate[]) newMethod.invoke( toolchainManager, new Object[]{ type, session } );
|
return (ToolchainPrivate[]) newMethod.invoke( toolchainManager, new Object[]{ type, session } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( NoSuchMethodException e )
|
catch ( NoSuchMethodException | InvocationTargetException | IllegalAccessException e )
|
||||||
{
|
|
||||||
throw new MojoExecutionException( "Incompatible toolchain API", e );
|
|
||||||
}
|
|
||||||
catch ( IllegalAccessException e )
|
|
||||||
{
|
|
||||||
throw new MojoExecutionException( "Incompatible toolchain API", e );
|
|
||||||
}
|
|
||||||
catch ( InvocationTargetException e )
|
|
||||||
{
|
{
|
||||||
throw new MojoExecutionException( "Incompatible toolchain API", e );
|
throw new MojoExecutionException( "Incompatible toolchain API", e );
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,10 @@ import java.util.Properties;
|
||||||
/**
|
/**
|
||||||
* Dumps the authentication info registered with the wagon manager for a server to a properties file.
|
* Dumps the authentication info registered with the wagon manager for a server to a properties file.
|
||||||
*
|
*
|
||||||
* @goal dump-auth
|
|
||||||
* @phase validate
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal dump-auth
|
||||||
|
* @phase validate
|
||||||
*/
|
*/
|
||||||
public class DumpAuthMojo
|
public class DumpAuthMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -83,9 +82,8 @@ public class DumpAuthMojo
|
||||||
{
|
{
|
||||||
Properties authProperties = new Properties();
|
Properties authProperties = new Properties();
|
||||||
|
|
||||||
for ( int i = 0; i < serverIds.length; i++ )
|
for ( String serverId : serverIds )
|
||||||
{
|
{
|
||||||
String serverId = serverIds[i];
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Getting authentication info for server " + serverId );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Getting authentication info for server " + serverId );
|
||||||
|
|
||||||
AuthenticationInfo authInfo = wagonManager.getAuthenticationInfo( serverId );
|
AuthenticationInfo authInfo = wagonManager.getAuthenticationInfo( serverId );
|
||||||
|
|
|
@ -38,11 +38,10 @@ import java.util.Properties;
|
||||||
* Loads resources from a class loader used to load a wagon provider. The wagon is merely used to access the extension
|
* Loads resources from a class loader used to load a wagon provider. The wagon is merely used to access the extension
|
||||||
* class loader it came from which is otherwise not accessible to a plugin.
|
* class loader it came from which is otherwise not accessible to a plugin.
|
||||||
*
|
*
|
||||||
* @goal load-resource
|
|
||||||
* @phase validate
|
|
||||||
*
|
|
||||||
* @author Benjamin Bentmann
|
* @author Benjamin Bentmann
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @goal load-resource
|
||||||
|
* @phase validate
|
||||||
*/
|
*/
|
||||||
public class LoadResourceMojo
|
public class LoadResourceMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -123,9 +122,8 @@ public class LoadResourceMojo
|
||||||
|
|
||||||
if ( resourcePaths != null )
|
if ( resourcePaths != null )
|
||||||
{
|
{
|
||||||
for ( int i = 0; i < resourcePaths.length; i++ )
|
for ( String path : resourcePaths )
|
||||||
{
|
{
|
||||||
String path = resourcePaths[i];
|
|
||||||
getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path );
|
getLog().info( "[MAVEN-CORE-IT-LOG] Loading resource " + path );
|
||||||
|
|
||||||
URL url = classLoader.getResource( path );
|
URL url = classLoader.getResource( path );
|
||||||
|
|
|
@ -19,15 +19,6 @@ package org.apache.maven.wagon.providers.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.wagon.AbstractWagon;
|
import org.apache.maven.wagon.AbstractWagon;
|
||||||
import org.apache.maven.wagon.ConnectionException;
|
import org.apache.maven.wagon.ConnectionException;
|
||||||
import org.apache.maven.wagon.InputData;
|
import org.apache.maven.wagon.InputData;
|
||||||
|
@ -38,6 +29,15 @@ import org.apache.maven.wagon.authentication.AuthenticationException;
|
||||||
import org.apache.maven.wagon.authorization.AuthorizationException;
|
import org.apache.maven.wagon.authorization.AuthorizationException;
|
||||||
import org.apache.maven.wagon.resource.Resource;
|
import org.apache.maven.wagon.resource.Resource;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shamelessly copied from ScpExternalWagon in this same project...
|
* Shamelessly copied from ScpExternalWagon in this same project...
|
||||||
*
|
*
|
||||||
|
@ -63,8 +63,8 @@ public class CoreItHttpWagon
|
||||||
|
|
||||||
if ( is == null )
|
if ( is == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open input stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
createParentDirectories( destination );
|
createParentDirectories( destination );
|
||||||
|
@ -95,8 +95,8 @@ public class CoreItHttpWagon
|
||||||
|
|
||||||
if ( os == null )
|
if ( os == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open output stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
putTransfer( outputData.getResource(), source, os, true );
|
putTransfer( outputData.getResource(), source, os, true );
|
||||||
|
@ -154,15 +154,10 @@ public class CoreItHttpWagon
|
||||||
{
|
{
|
||||||
new File( "target" ).mkdirs();
|
new File( "target" ).mkdirs();
|
||||||
|
|
||||||
OutputStream os = new FileOutputStream( "target/wagon.properties" );
|
try ( OutputStream os = new FileOutputStream( "target/wagon.properties" ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,15 +19,6 @@ package org.apache.maven.wagon.providers.coreit;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.wagon.AbstractWagon;
|
import org.apache.maven.wagon.AbstractWagon;
|
||||||
import org.apache.maven.wagon.ConnectionException;
|
import org.apache.maven.wagon.ConnectionException;
|
||||||
import org.apache.maven.wagon.InputData;
|
import org.apache.maven.wagon.InputData;
|
||||||
|
@ -39,6 +30,15 @@ import org.apache.maven.wagon.authentication.AuthenticationInfo;
|
||||||
import org.apache.maven.wagon.authorization.AuthorizationException;
|
import org.apache.maven.wagon.authorization.AuthorizationException;
|
||||||
import org.apache.maven.wagon.resource.Resource;
|
import org.apache.maven.wagon.resource.Resource;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shamelessly copied from ScpExternalWagon in this same project...
|
* Shamelessly copied from ScpExternalWagon in this same project...
|
||||||
*
|
*
|
||||||
|
@ -64,8 +64,8 @@ public class CoreItWagon
|
||||||
|
|
||||||
if ( is == null )
|
if ( is == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open input stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
createParentDirectories( destination );
|
createParentDirectories( destination );
|
||||||
|
@ -96,8 +96,8 @@ public class CoreItWagon
|
||||||
|
|
||||||
if ( os == null )
|
if ( os == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open output stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
putTransfer( outputData.getResource(), source, os, true );
|
putTransfer( outputData.getResource(), source, os, true );
|
||||||
|
@ -165,15 +165,10 @@ public class CoreItWagon
|
||||||
File file = new File( "target/wagon.properties" ).getAbsoluteFile();
|
File file = new File( "target/wagon.properties" ).getAbsoluteFile();
|
||||||
file.getParentFile().mkdirs();
|
file.getParentFile().mkdirs();
|
||||||
|
|
||||||
OutputStream os = new FileOutputStream( file );
|
try ( OutputStream os = new FileOutputStream( file ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,15 +19,6 @@ package org.apache.maven.wagon.providers.ssh.external;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.Properties;
|
|
||||||
|
|
||||||
import org.apache.maven.wagon.AbstractWagon;
|
import org.apache.maven.wagon.AbstractWagon;
|
||||||
import org.apache.maven.wagon.ConnectionException;
|
import org.apache.maven.wagon.ConnectionException;
|
||||||
import org.apache.maven.wagon.InputData;
|
import org.apache.maven.wagon.InputData;
|
||||||
|
@ -38,6 +29,15 @@ import org.apache.maven.wagon.authentication.AuthenticationException;
|
||||||
import org.apache.maven.wagon.authorization.AuthorizationException;
|
import org.apache.maven.wagon.authorization.AuthorizationException;
|
||||||
import org.apache.maven.wagon.resource.Resource;
|
import org.apache.maven.wagon.resource.Resource;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* NOTE: Plexus will only pick this correctly if the Class package and name are the same as that in core. This is
|
* NOTE: Plexus will only pick this correctly if the Class package and name are the same as that in core. This is
|
||||||
* because the core component descriptor is read, but the class is read from the latter JAR.
|
* because the core component descriptor is read, but the class is read from the latter JAR.
|
||||||
|
@ -64,8 +64,8 @@ public class ScpExternalWagon
|
||||||
|
|
||||||
if ( is == null )
|
if ( is == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open input stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open input stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
createParentDirectories( destination );
|
createParentDirectories( destination );
|
||||||
|
@ -98,8 +98,8 @@ public class ScpExternalWagon
|
||||||
|
|
||||||
if ( os == null )
|
if ( os == null )
|
||||||
{
|
{
|
||||||
throw new TransferFailedException( getRepository().getUrl()
|
throw new TransferFailedException(
|
||||||
+ " - Could not open output stream for resource: '" + resource + "'" );
|
getRepository().getUrl() + " - Could not open output stream for resource: '" + resource + "'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
putTransfer( outputData.getResource(), source, os, true );
|
putTransfer( outputData.getResource(), source, os, true );
|
||||||
|
@ -145,15 +145,10 @@ public class ScpExternalWagon
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
OutputStream os = new FileOutputStream( new File( dir, "wagon.properties" ) );
|
try ( OutputStream os = new FileOutputStream( new File( dir, "wagon.properties" ) ) )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
props.store( os, "MAVEN-CORE-IT-WAGON" );
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
os.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.it;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
import org.apache.maven.artifact.versioning.ArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||||
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
|
||||||
|
@ -34,8 +35,6 @@ import java.util.Locale;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
* @author Kenney Westerhof
|
* @author Kenney Westerhof
|
||||||
|
@ -358,7 +357,7 @@ public abstract class AbstractMavenIntegrationTestCase
|
||||||
|
|
||||||
private String pad( int chars )
|
private String pad( int chars )
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer( 128 );
|
StringBuilder buffer = new StringBuilder( 128 );
|
||||||
for ( int i = 0; i < chars; i++ )
|
for ( int i = 0; i < chars; i++ )
|
||||||
{
|
{
|
||||||
buffer.append( '.' );
|
buffer.append( '.' );
|
||||||
|
|
Loading…
Reference in New Issue