You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by fg...@apache.org on 2006/12/16 17:00:01 UTC
svn commit: r487820 [1/2] - in /maven/sandbox: maven-common-artifact-filters/
maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/
maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/
mave...
Author: fgiust
Date: Sat Dec 16 07:59:59 2006
New Revision: 487820
URL: http://svn.apache.org/viewvc?view=rev&rev=487820
Log:
fixed license headers (+ some formatting): no functional changes in this commit
Modified:
maven/sandbox/maven-common-artifact-filters/ (props changed)
maven/sandbox/maven-common-artifact-filters/pom.xml
maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilter.java
maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java
maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilter.java
maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/StatisticsReportingArtifactFilter.java
maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternArtifactFilterTCK.java
maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilterTest.java
maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilterTest.java
maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java
maven/sandbox/maven-plugin-testing-tools/pom.xml
maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java
maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java
maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java
maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/TestToolsException.java
maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java
maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java
maven/sandbox/maven-repository-builder/ (props changed)
maven/sandbox/maven-repository-builder/pom.xml
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/DefaultRepositoryAssembler.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssembler.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssemblyException.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryBuilderConfigSource.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/model/DefaultRepositoryInfo.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/model/GroupVersionAlignment.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/model/RepositoryInfo.java
maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/utils/DigestUtils.java
maven/sandbox/maven-test-tools/ (props changed)
maven/sandbox/maven-test-tools/pom.xml
maven/sandbox/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/MockManager.java
maven/sandbox/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestFileManager.java
maven/sandbox/maven-test-tools/src/main/java/org/apache/maven/shared/tools/easymock/TestUtils.java
maven/sandbox/maven-test-tools/src/main/java/org/apache/maven/shared/tools/test/ReflectiveSetter.java
Propchange: maven/sandbox/maven-common-artifact-filters/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec 16 07:59:59 2006
@@ -0,0 +1 @@
+target
Modified: maven/sandbox/maven-common-artifact-filters/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/pom.xml?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/pom.xml (original)
+++ maven/sandbox/maven-common-artifact-filters/pom.xml Sat Dec 16 07:59:59 2006
@@ -1,22 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>4-SNAPSHOT</version>
</parent>
-
<artifactId>maven-common-artifact-filters</artifactId>
<version>1.0-SNAPSHOT</version>
-
<name>Maven Common Artifact Filters</name>
-
<prerequisites>
<maven>2.0.2</maven>
</prerequisites>
-
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
Modified: maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilter.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilter.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilter.java Sat Dec 16 07:59:59 2006
@@ -1,25 +1,27 @@
-package org.apache.maven.shared.artifact.filter;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-
-import org.apache.maven.artifact.Artifact;
+package org.apache.maven.shared.artifact.filter;
import java.util.List;
+import org.apache.maven.artifact.Artifact;
+
/**
* TODO: include in maven-artifact in future
*
@@ -41,12 +43,12 @@
public boolean include( Artifact artifact )
{
boolean shouldInclude = !patternMatches( artifact );
-
+
if ( !shouldInclude )
{
addFilteredArtifactId( artifact.getId() );
}
-
+
return shouldInclude;
}
@@ -54,10 +56,10 @@
{
return "artifact exclusion filter";
}
-
+
public String toString()
{
return "Excludes filter:" + getPatternsAsString();
}
-
+
}
Modified: maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java Sat Dec 16 07:59:59 2006
@@ -1,26 +1,22 @@
-package org.apache.maven.shared.artifact.filter;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.util.StringUtils;
+package org.apache.maven.shared.artifact.filter;
import java.util.ArrayList;
import java.util.HashSet;
@@ -28,6 +24,12 @@
import java.util.List;
import java.util.Set;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.ArtifactUtils;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.StringUtils;
+
/**
* TODO: include in maven-artifact in future
*
@@ -37,10 +39,13 @@
implements ArtifactFilter, StatisticsReportingArtifactFilter
{
private final List positivePatterns;
+
private final List negativePatterns;
+
private final boolean actTransitively;
private Set patternsTriggered = new HashSet();
+
private List filteredArtifactIds = new ArrayList();
public PatternIncludesArtifactFilter( List patterns )
@@ -58,7 +63,7 @@
for ( Iterator it = patterns.iterator(); it.hasNext(); )
{
String pattern = (String) it.next();
-
+
if ( pattern.startsWith( "!" ) )
{
neg.add( pattern.substring( 1 ) );
@@ -69,7 +74,7 @@
}
}
}
-
+
this.positivePatterns = pos;
this.negativePatterns = neg;
}
@@ -125,17 +130,17 @@
String shortId = ArtifactUtils.versionlessKey( artifact );
String id = artifact.getDependencyConflictId();
String wholeId = artifact.getId();
-
+
if ( matchAgainst( wholeId, patterns, false ) )
{
return true;
}
-
+
if ( matchAgainst( id, patterns, false ) )
{
return true;
}
-
+
if ( matchAgainst( shortId, patterns, false ) )
{
return true;
@@ -162,7 +167,7 @@
{
// TODO: what about wildcards? Just specifying groups? versions?
String pattern = (String) i.next();
-
+
// don't allow wildcards in region-matched searches...i.e. in transitive dependencies.
if ( regionMatch && pattern.indexOf( '*' ) > -1 )
{
@@ -185,38 +190,38 @@
return true;
}
}
-
+
if ( pattern.indexOf( '*' ) > -1 )
{
String[] subPatterns = pattern.split( "\\*" );
int[] idxes = new int[subPatterns.length];
-
+
for ( int j = 0; j < subPatterns.length; j++ )
{
String subPattern = subPatterns[j];
-
+
if ( subPattern == null || subPattern.length() < 1 )
{
- idxes[j] = j == 0 ? 0 : idxes[j-1];
-
+ idxes[j] = j == 0 ? 0 : idxes[j - 1];
+
continue;
}
-
- int lastIdx = j == 0 ? 0 : idxes[j-1];
-
+
+ int lastIdx = j == 0 ? 0 : idxes[j - 1];
+
idxes[j] = value.indexOf( subPattern, lastIdx );
-
+
if ( idxes[j] < 0 )
{
return false;
}
}
-
+
patternsTriggered.add( pattern );
return true;
}
}
-
+
return false;
}
@@ -228,7 +233,7 @@
List missed = new ArrayList();
missed.addAll( positivePatterns );
missed.addAll( negativePatterns );
-
+
missed.removeAll( patternsTriggered );
if ( !missed.isEmpty() && logger.isWarnEnabled() )
@@ -263,7 +268,7 @@
StringBuffer buffer = new StringBuffer();
for ( Iterator it = positivePatterns.iterator(); it.hasNext(); )
{
- String pattern = ( String ) it.next();
+ String pattern = (String) it.next();
buffer.append( "\no \'" ).append( pattern ).append( "\'" );
}
@@ -280,11 +285,12 @@
{
if ( !filteredArtifactIds.isEmpty() && logger.isDebugEnabled() )
{
- StringBuffer buffer = new StringBuffer( "The following artifacts were removed by this " + getFilterDescription() + ": " );
+ StringBuffer buffer = new StringBuffer( "The following artifacts were removed by this "
+ + getFilterDescription() + ": " );
for ( Iterator it = filteredArtifactIds.iterator(); it.hasNext(); )
{
- String artifactId = ( String ) it.next();
+ String artifactId = (String) it.next();
buffer.append( '\n' ).append( artifactId );
}
@@ -301,12 +307,12 @@
List missed = new ArrayList();
missed.addAll( positivePatterns );
missed.addAll( negativePatterns );
-
+
missed.removeAll( patternsTriggered );
return !missed.isEmpty();
}
-
+
return false;
}
Modified: maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilter.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilter.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilter.java Sat Dec 16 07:59:59 2006
@@ -1,30 +1,32 @@
-package org.apache.maven.shared.artifact.filter;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+package org.apache.maven.shared.artifact.filter;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.codehaus.plexus.logging.Logger;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
/**
* TODO: include in maven-artifact in future
*/
@@ -146,7 +148,7 @@
public String toString()
{
return "Scope filter [compile=" + compileScope + ", runtime=" + runtimeScope + ", test=" + testScope
- + ", provided=" + providedScope + ", system=" + systemScope + "]";
+ + ", provided=" + providedScope + ", system=" + systemScope + "]";
}
public void reportFilteredArtifacts( Logger logger )
@@ -157,7 +159,7 @@
for ( Iterator it = filteredArtifactIds.iterator(); it.hasNext(); )
{
- String artifactId = ( String ) it.next();
+ String artifactId = (String) it.next();
buffer.append( '\n' ).append( artifactId );
}
@@ -209,7 +211,7 @@
public boolean hasMissedCriteria()
{
boolean report = false;
-
+
if ( !compileScopeHit )
{
report = true;
Modified: maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/StatisticsReportingArtifactFilter.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/StatisticsReportingArtifactFilter.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/StatisticsReportingArtifactFilter.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/main/java/org/apache/maven/shared/artifact/filter/StatisticsReportingArtifactFilter.java Sat Dec 16 07:59:59 2006
@@ -1,14 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.artifact.filter;
import org.codehaus.plexus.logging.Logger;
public interface StatisticsReportingArtifactFilter
{
-
+
void reportMissedCriteria( Logger logger );
-
+
void reportFilteredArtifacts( Logger logger );
-
+
boolean hasMissedCriteria();
}
Modified: maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternArtifactFilterTCK.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternArtifactFilterTCK.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternArtifactFilterTCK.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternArtifactFilterTCK.java Sat Dec 16 07:59:59 2006
@@ -1,16 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.artifact.filter;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.shared.tools.easymock.MockManager;
-import org.easymock.MockControl;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import junit.framework.TestCase;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
+import org.apache.maven.shared.tools.easymock.MockManager;
+import org.easymock.MockControl;
public abstract class PatternArtifactFilterTCK
extends TestCase
@@ -22,7 +39,7 @@
protected abstract ArtifactFilter createFilter( List patterns, boolean actTransitively );
- public void testShouldIncludeDirectlyMatchedArtifactByGroupIdArtifactId(boolean reverse)
+ public void testShouldIncludeDirectlyMatchedArtifactByGroupIdArtifactId( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -45,7 +62,7 @@
mockManager.verifyAll();
}
- public void testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId(boolean reverse)
+ public void testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -68,7 +85,7 @@
mockManager.verifyAll();
}
- public void testShouldNotIncludeWhenGroupIdDiffers(boolean reverse)
+ public void testShouldNotIncludeWhenGroupIdDiffers( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -78,7 +95,6 @@
mockManager.replayAll();
List patterns = new ArrayList();
-
patterns.add( "otherGroup:" + artifactId + ":jar" );
patterns.add( "otherGroup:" + artifactId );
@@ -96,7 +112,7 @@
mockManager.verifyAll();
}
- public void testShouldNotIncludeWhenArtifactIdDiffers(boolean reverse)
+ public void testShouldNotIncludeWhenArtifactIdDiffers( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -124,7 +140,7 @@
mockManager.verifyAll();
}
- public void testShouldNotIncludeWhenBothIdElementsDiffer(boolean reverse)
+ public void testShouldNotIncludeWhenBothIdElementsDiffer( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -152,7 +168,7 @@
mockManager.verifyAll();
}
- public void testShouldIncludeWhenPatternMatchesDependencyTrailAndTransitivityIsEnabled(boolean reverse)
+ public void testShouldIncludeWhenPatternMatchesDependencyTrailAndTransitivityIsEnabled( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -260,7 +276,7 @@
mockManager.verifyAll();
}
- public void testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent(boolean reverse)
+ public void testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent( boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -268,13 +284,14 @@
String otherGroup = "otherGroup";
String otherArtifact = "otherArtifact";
String otherType = "ejb";
-
+
String depTrailItem = otherGroup + ":" + otherArtifact + ":" + otherType + ":version";
List depTrail = Collections.singletonList( depTrailItem );
List patterns = Collections.singletonList( "*:jar:*" );
ArtifactMockAndControl mac = new ArtifactMockAndControl( groupId, artifactId, "jar", depTrail );
- ArtifactMockAndControl otherMac = new ArtifactMockAndControl( otherGroup, otherArtifact, otherType, Collections.EMPTY_LIST );
+ ArtifactMockAndControl otherMac = new ArtifactMockAndControl( otherGroup, otherArtifact, otherType,
+ Collections.EMPTY_LIST );
mockManager.replayAll();
@@ -294,7 +311,8 @@
mockManager.verifyAll();
}
- public void testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild(boolean reverse)
+ public void testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild(
+ boolean reverse )
{
String groupId = "group";
String artifactId = "artifact";
@@ -302,7 +320,7 @@
String otherGroup = "otherGroup";
String otherArtifact = "otherArtifact";
String otherType = "ejb";
-
+
String depTrailItem = otherGroup + ":" + otherArtifact + ":" + otherType + ":version";
List depTrail = Collections.singletonList( depTrailItem );
List patterns = Collections.singletonList( "!*:ejb:*" );
@@ -331,10 +349,15 @@
private final class ArtifactMockAndControl
{
MockControl control;
+
Artifact artifact;
+
String groupId;
+
String artifactId;
+
List dependencyTrail;
+
String type;
ArtifactMockAndControl( String groupId, String artifactId, List depTrail )
Modified: maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilterTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilterTest.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilterTest.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternExcludesArtifactFilterTest.java Sat Dec 16 07:59:59 2006
@@ -1,17 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.artifact.filter;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
-
import java.util.List;
import junit.framework.TestCase;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
public class PatternExcludesArtifactFilterTest
extends TestCase
{
-
+
private PatternArtifactFilterTCK tck = new PatternArtifactFilterTCK()
{
@@ -24,9 +40,9 @@
{
return new PatternExcludesArtifactFilter( patterns, actTransitively );
}
-
+
};
-
+
public void testShouldNotIncludeDirectlyMatchedArtifactByDependencyConflictId()
{
tck.testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId( true );
@@ -71,12 +87,12 @@
{
tck.testShouldIncludeWhenWildcardMatchesOutsideSequence( true );
}
-
+
public void testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent()
{
tck.testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent( true );
}
-
+
public void testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild()
{
tck.testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild( true );
Modified: maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilterTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilterTest.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilterTest.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilterTest.java Sat Dec 16 07:59:59 2006
@@ -1,12 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.artifact.filter;
-import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
-
import java.util.List;
import junit.framework.TestCase;
+import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
public class PatternIncludesArtifactFilterTest
extends TestCase
@@ -23,9 +39,9 @@
{
return new PatternIncludesArtifactFilter( patterns, actTransitively );
}
-
+
};
-
+
public void testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId()
{
tck.testShouldIncludeDirectlyMatchedArtifactByDependencyConflictId( false );
@@ -75,7 +91,7 @@
{
tck.testShouldIncludeTransitiveDependencyWhenWildcardMatchesButDoesntMatchParent( false );
}
-
+
public void testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild()
{
tck.testShouldIncludeDirectDependencyWhenInvertedWildcardMatchesButDoesntMatchTransitiveChild( false );
Modified: maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java (original)
+++ maven/sandbox/maven-common-artifact-filters/src/test/java/org/apache/maven/shared/artifact/filter/ScopeArtifactFilterTest.java Sat Dec 16 07:59:59 2006
@@ -1,20 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.artifact.filter;
+import junit.framework.TestCase;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
-import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter;
import org.apache.maven.shared.tools.easymock.MockManager;
import org.easymock.MockControl;
-import junit.framework.TestCase;
-
-
public class ScopeArtifactFilterTest
extends TestCase
{
-
+
private MockManager mockManager = new MockManager();
-
+
public void testScopesShouldIncludeArtifactWithSameScope()
{
verifyIncluded( Artifact.SCOPE_COMPILE, Artifact.SCOPE_COMPILE );
@@ -24,11 +40,11 @@
verifyIncluded( Artifact.SCOPE_TEST, Artifact.SCOPE_TEST );
verifyIncluded( null, null );
}
-
+
public void testCompileScopeShouldIncludeOnlyArtifactsWithNullSystemProvidedOrCompileScopes()
{
String scope = Artifact.SCOPE_COMPILE;
-
+
verifyIncluded( scope, null );
verifyIncluded( scope, Artifact.SCOPE_COMPILE );
verifyIncluded( scope, Artifact.SCOPE_PROVIDED );
@@ -37,73 +53,74 @@
verifyExcluded( scope, Artifact.SCOPE_RUNTIME );
verifyExcluded( scope, Artifact.SCOPE_TEST );
}
-
+
public void testRuntimeScopeShouldIncludeOnlyArtifactsWithNullRuntimeOrCompileScopes()
{
String scope = Artifact.SCOPE_RUNTIME;
-
+
verifyIncluded( scope, null );
verifyIncluded( scope, Artifact.SCOPE_COMPILE );
verifyIncluded( scope, Artifact.SCOPE_RUNTIME );
-
+
verifyExcluded( scope, Artifact.SCOPE_PROVIDED );
verifyExcluded( scope, Artifact.SCOPE_SYSTEM );
verifyExcluded( scope, Artifact.SCOPE_TEST );
}
-
+
public void testTestScopeShouldIncludeAllScopes()
{
String scope = Artifact.SCOPE_TEST;
-
+
verifyIncluded( scope, null );
verifyIncluded( scope, Artifact.SCOPE_COMPILE );
verifyIncluded( scope, Artifact.SCOPE_RUNTIME );
-
+
verifyIncluded( scope, Artifact.SCOPE_PROVIDED );
verifyIncluded( scope, Artifact.SCOPE_SYSTEM );
verifyIncluded( scope, Artifact.SCOPE_TEST );
}
-
+
public void testProvidedScopeShouldIncludeOnlyArtifactsWithNullOrProvidedScopes()
{
String scope = Artifact.SCOPE_PROVIDED;
-
+
verifyIncluded( scope, null );
verifyExcluded( scope, Artifact.SCOPE_COMPILE );
verifyExcluded( scope, Artifact.SCOPE_RUNTIME );
-
+
verifyIncluded( scope, Artifact.SCOPE_PROVIDED );
-
+
verifyExcluded( scope, Artifact.SCOPE_SYSTEM );
verifyExcluded( scope, Artifact.SCOPE_TEST );
}
-
+
public void testSystemScopeShouldIncludeOnlyArtifactsWithNullOrSystemScopes()
{
String scope = Artifact.SCOPE_SYSTEM;
-
+
verifyIncluded( scope, null );
verifyExcluded( scope, Artifact.SCOPE_COMPILE );
verifyExcluded( scope, Artifact.SCOPE_RUNTIME );
verifyExcluded( scope, Artifact.SCOPE_PROVIDED );
-
+
verifyIncluded( scope, Artifact.SCOPE_SYSTEM );
-
+
verifyExcluded( scope, Artifact.SCOPE_TEST );
}
-
+
private void verifyIncluded( String filterScope, String artifactScope )
{
ArtifactMockAndControl mac = new ArtifactMockAndControl( artifactScope );
-
+
mockManager.replayAll();
-
+
ArtifactFilter filter = new ScopeArtifactFilter( filterScope );
-
- assertTrue( "Artifact scope: " + artifactScope + " NOT included using filter scope: " + filterScope, filter.include( mac.artifact ) );
-
+
+ assertTrue( "Artifact scope: " + artifactScope + " NOT included using filter scope: " + filterScope, filter
+ .include( mac.artifact ) );
+
mockManager.verifyAll();
-
+
// enable multiple calls to this method within a single test.
mockManager.clear();
}
@@ -111,15 +128,16 @@
private void verifyExcluded( String filterScope, String artifactScope )
{
ArtifactMockAndControl mac = new ArtifactMockAndControl( artifactScope );
-
+
mockManager.replayAll();
-
+
ArtifactFilter filter = new ScopeArtifactFilter( filterScope );
-
- assertFalse( "Artifact scope: " + artifactScope + " NOT excluded using filter scope: " + filterScope, filter.include( mac.artifact ) );
-
+
+ assertFalse( "Artifact scope: " + artifactScope + " NOT excluded using filter scope: " + filterScope, filter
+ .include( mac.artifact ) );
+
mockManager.verifyAll();
-
+
// enable multiple calls to this method within a single test.
mockManager.clear();
}
@@ -127,28 +145,30 @@
private final class ArtifactMockAndControl
{
Artifact artifact;
+
MockControl control;
+
private final String scope;
-
+
ArtifactMockAndControl( String scope )
{
this.scope = scope;
-
+
control = MockControl.createControl( Artifact.class );
mockManager.add( control );
-
+
artifact = (Artifact) control.getMock();
-
+
enableGetScope();
enableGetId();
}
-
+
void enableGetScope()
{
artifact.getScope();
control.setReturnValue( scope, MockControl.ONE_OR_MORE );
}
-
+
void enableGetId()
{
artifact.getId();
Modified: maven/sandbox/maven-plugin-testing-tools/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/pom.xml?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/pom.xml (original)
+++ maven/sandbox/maven-plugin-testing-tools/pom.xml Sat Dec 16 07:59:59 2006
@@ -1,3 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
Modified: maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/BuildTool.java Sat Dec 16 07:59:59 2006
@@ -1,5 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.List;
+import java.util.Properties;
+
import org.apache.maven.shared.invoker.DefaultInvocationRequest;
import org.apache.maven.shared.invoker.DefaultInvoker;
import org.apache.maven.shared.invoker.InvocationOutputHandler;
@@ -13,12 +37,6 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.cli.CommandLineUtils;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-
/**
* Test-tool used to execute Maven builds in order to test plugin functionality.
*
@@ -30,7 +48,7 @@
implements Initializable, Disposable
{
public static final String ROLE = BuildTool.class.getName();
-
+
private Invoker mavenInvoker;
/**
@@ -50,10 +68,10 @@
throws TestToolsException
{
InvocationRequest request = createBasicInvocationRequest( pom, properties, goals, buildLogFile );
-
+
return executeMaven( request );
}
-
+
/**
* Execute a test build using a customized InvocationRequest. Normally, this request would be
* created using the <code>createBasicInvocationRequest</code> method in this class.
@@ -64,7 +82,7 @@
* exceptions resulting from the [attempted] Maven invocation.
*/
public InvocationResult executeMaven( InvocationRequest request )
- throws TestToolsException
+ throws TestToolsException
{
try
{
@@ -93,13 +111,13 @@
if ( mavenInvoker == null )
{
mavenInvoker = new DefaultInvoker();
-
+
if ( System.getProperty( "maven.home" ) == null )
{
Properties envars = CommandLineUtils.getSystemEnvVars();
-
+
String mavenHome = envars.getProperty( "M2_HOME" );
-
+
if ( mavenHome != null )
{
mavenInvoker.setMavenHome( new File( mavenHome ) );
@@ -147,7 +165,7 @@
* customizations.
*/
public InvocationRequest createBasicInvocationRequest( File pom, Properties properties, List goals,
- File buildLogFile )
+ File buildLogFile )
{
InvocationRequest request = new DefaultInvocationRequest();
@@ -228,7 +246,7 @@
{
throw new InitializationException( "Error detecting maven home.", e );
}
-
+
}
/**
Modified: maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/PluginTestTool.java Sat Dec 16 07:59:59 2006
@@ -1,9 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
-import org.apache.maven.project.MavenProject;
-
import java.io.File;
+import org.apache.maven.project.MavenProject;
+
/**
* Test tool that provides a single point of access for staging a plugin artifact - along with its
* POM lineage - into a clean test-time local repository. This involves modifying the plugin POM to
@@ -107,7 +125,7 @@
File pomFile = new File( "pom.xml" );
File buildLog = new File( "target/test-build-logs/setup.build.log" );
File localRepoDir = localRepositoryDir;
-
+
if ( localRepoDir == null )
{
localRepoDir = new File( "target/test-local-repository" );
Modified: maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/ProjectTool.java Sat Dec 16 07:59:59 2006
@@ -1,5 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.handler.ArtifactHandler;
@@ -18,15 +45,6 @@
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
/**
* Testing tool used to read MavenProject instances from pom.xml files, and to create plugin jar
* files (package phase of the normal build process) for distribution to a test local repository
@@ -53,7 +71,7 @@
* @plexus.requirement
*/
private MavenProjectBuilder projectBuilder;
-
+
/**
* @plexus.requirement
*/
@@ -158,11 +176,12 @@
MavenProject project = projectBuilder.build( pomInfo.getPomFile(), repositoryTool
.createLocalArtifactRepositoryInstance(), null );
- Artifact artifact = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(), null, project.getPackaging() );
-
+ Artifact artifact = artifactFactory.createArtifact( project.getGroupId(), project.getArtifactId(), project
+ .getVersion(), null, project.getPackaging() );
+
artifact.setFile( artifactFile );
artifact.addMetadata( new ProjectArtifactMetadata( artifact, project.getFile() ) );
-
+
project.setArtifact( artifact );
return project;
@@ -218,18 +237,18 @@
}
finalName = build.getFinalName();
-
+
if ( finalName == null )
{
ArtifactHandler handler = artifactHandlerManager.getArtifactHandler( model.getPackaging() );
-
+
String ext = handler.getExtension();
-
+
finalName = model.getArtifactId() + "-" + model.getVersion() + "." + ext;
}
-
+
buildOutputDirectory = build.getOutputDirectory();
-
+
if ( buildOutputDirectory == null )
{
buildOutputDirectory = "target";
Modified: maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/RepositoryTool.java Sat Dec 16 07:59:59 2006
@@ -1,5 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.MalformedURLException;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.installer.ArtifactInstallationException;
@@ -23,11 +46,6 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.MalformedURLException;
-
/**
* Tools to access and manage Maven repositories for test builds, including construction of a local
* repository directory structure.
@@ -73,7 +91,8 @@
/**
* Lookup and return the location of the normal Maven local repository.
*/
- public File findLocalRepositoryDirectory() throws TestToolsException
+ public File findLocalRepositoryDirectory()
+ throws TestToolsException
{
Settings settings;
try
@@ -99,7 +118,7 @@
throws TestToolsException
{
File localRepoDir = findLocalRepositoryDirectory();
-
+
return createLocalArtifactRepositoryInstance( localRepoDir );
}
@@ -251,7 +270,8 @@
}
catch ( ArtifactInstallationException e )
{
- throw new TestToolsException( "Error installing ancestor POM: " + currentPom + " to target local repository: " + localRepo.getBasedir(), e );
+ throw new TestToolsException( "Error installing ancestor POM: " + currentPom
+ + " to target local repository: " + localRepo.getBasedir(), e );
}
}
else
Modified: maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/TestToolsException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/TestToolsException.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/TestToolsException.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/main/java/org/apache/maven/shared/test/plugin/TestToolsException.java Sat Dec 16 07:59:59 2006
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
public class TestToolsException
Modified: maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/ProjectToolTest.java Sat Dec 16 07:59:59 2006
@@ -1,5 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.project.MavenProject;
@@ -8,27 +30,25 @@
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.StringUtils;
-import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
-
public class ProjectToolTest
extends PlexusTestCase
{
-
- public void testManglePomForTesting_ShouldPopulateOutDirAndFinalName() throws Exception
+
+ public void testManglePomForTesting_ShouldPopulateOutDirAndFinalName()
+ throws Exception
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
-
+
File pomFile = new File( "pom.xml" );
-
+
PomInfo info = tool.manglePomForTesting( pomFile, "test", true );
-
+
assertEquals( "target", info.getBuildOutputDirectory() );
assertEquals( "maven-plugin-testing-tools-test.jar", info.getFinalName() );
}
- public void testPackageProjectArtifact_ShouldPopulateArtifactFileWithJarLocation() throws Exception
+ public void testPackageProjectArtifact_ShouldPopulateArtifactFileWithJarLocation()
+ throws Exception
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
@@ -42,34 +62,35 @@
assertEquals( expectedPath, actualPath );
}
-
- public void testPackageProjectArtifact_ShouldPopulateWithCorrectArtifactAndMetadata() throws Exception
+
+ public void testPackageProjectArtifact_ShouldPopulateWithCorrectArtifactAndMetadata()
+ throws Exception
{
ProjectTool tool = (ProjectTool) lookup( ProjectTool.ROLE, "default" );
-
+
File pomFile = new File( "pom.xml" );
-
+
MavenProject project = tool.packageProjectArtifact( pomFile, "test", true );
-
+
Artifact artifact = project.getArtifact();
-
+
assertEquals( "jar", artifact.getType() );
assertTrue( artifact.getFile().exists() );
-
+
Collection metadata = artifact.getMetadataList();
-
+
boolean foundPomMetadata = false;
-
+
for ( Iterator it = metadata.iterator(); it.hasNext(); )
{
ArtifactMetadata metadataItem = (ArtifactMetadata) it.next();
-
+
if ( metadataItem instanceof ProjectArtifactMetadata )
{
foundPomMetadata = true;
}
}
-
+
assertTrue( foundPomMetadata );
}
}
Modified: maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java (original)
+++ maven/sandbox/maven-plugin-testing-tools/src/test/java/org/apache/maven/shared/test/plugin/RepositoryToolTest.java Sat Dec 16 07:59:59 2006
@@ -1,5 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.test.plugin;
+import java.io.File;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.project.MavenProject;
@@ -7,8 +27,6 @@
import org.apache.maven.shared.tools.easymock.TestFileManager;
import org.codehaus.plexus.PlexusTestCase;
-import java.io.File;
-
public class RepositoryToolTest
extends PlexusTestCase
{
@@ -19,7 +37,7 @@
throws Exception
{
super.setUp();
-
+
fileManager = new TestFileManager( "RepositoryToolTest.", "" );
}
@@ -27,7 +45,7 @@
throws Exception
{
super.tearDown();
-
+
fileManager.cleanUp();
}
@@ -35,33 +53,33 @@
throws Exception
{
RepositoryTool repoTool = (RepositoryTool) lookup( RepositoryTool.ROLE, "default" );
-
+
File tempDir = fileManager.createTempDir();
-
+
String pomContent = "<project><modelVersion>4.0.0</modelVersion></project>";
String jarContent = "This is a test";
-
+
File pom = fileManager.createFile( tempDir, "pom.xml", pomContent );
File jar = fileManager.createFile( tempDir, "artifact-test.jar", jarContent );
MavenProject pluginProject = new MavenProject();
-
+
ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
-
+
Artifact pluginArtifact = artifactFactory.createArtifact( "group", "artifact", "test", null, "jar" );
pluginArtifact.setFile( jar );
pluginArtifact.addMetadata( new ProjectArtifactMetadata( pluginArtifact, pom ) );
-
+
pluginProject.setArtifact( pluginArtifact );
pluginProject.setFile( pom );
-
+
File targetLocalRepoBasedir = fileManager.createTempDir();
repoTool.createLocalRepositoryFromPlugin( pluginProject, targetLocalRepoBasedir );
-
+
fileManager.assertFileExistence( targetLocalRepoBasedir, "group/artifact/test/artifact-test.pom", true );
fileManager.assertFileContents( targetLocalRepoBasedir, "group/artifact/test/artifact-test.jar", jarContent );
-
+
}
}
Propchange: maven/sandbox/maven-repository-builder/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec 16 07:59:59 2006
@@ -0,0 +1 @@
+target
Modified: maven/sandbox/maven-repository-builder/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-repository-builder/pom.xml?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-repository-builder/pom.xml (original)
+++ maven/sandbox/maven-repository-builder/pom.xml Sat Dec 16 07:59:59 2006
@@ -1,36 +1,34 @@
-<?xml version="1.0"?>
-
-<!--
- ~ Copyright 2006 The Apache Software Foundation.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>4-SNAPSHOT</version>
</parent>
-
<artifactId>maven-repository-builder</artifactId>
<version>1.0-SNAPSHOT</version>
-
<name>Maven Repository Builder</name>
<url>http://maven.apache.org</url>
-
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -71,7 +69,6 @@
<scope>test</scope>
</dependency>
</dependencies>
-
<build>
<plugins>
<plugin>
@@ -89,5 +86,4 @@
</plugin>
</plugins>
</build>
-
</project>
Modified: maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/DefaultRepositoryAssembler.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/DefaultRepositoryAssembler.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/DefaultRepositoryAssembler.java (original)
+++ maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/DefaultRepositoryAssembler.java Sat Dec 16 07:59:59 2006
@@ -1,20 +1,39 @@
-package org.apache.maven.shared.repository;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+package org.apache.maven.shared.repository;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.Field;
+import java.security.NoSuchAlgorithmException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.factory.ArtifactFactory;
@@ -37,34 +56,17 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.shared.repository.model.GroupVersionAlignment;
-import org.apache.maven.shared.repository.model.RepositoryInfo;
-import org.apache.maven.shared.repository.utils.DigestUtils;
import org.apache.maven.shared.artifact.filter.PatternExcludesArtifactFilter;
import org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter;
import org.apache.maven.shared.artifact.filter.ScopeArtifactFilter;
+import org.apache.maven.shared.repository.model.GroupVersionAlignment;
+import org.apache.maven.shared.repository.model.RepositoryInfo;
+import org.apache.maven.shared.repository.utils.DigestUtils;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.Field;
-import java.security.NoSuchAlgorithmException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TimeZone;
-
/**
* @author Jason van Zyl
* @plexus.component role="org.apache.maven.shared.repository.RepositoryAssembler" role-hint="default"
@@ -109,7 +111,8 @@
*/
protected MavenProjectBuilder projectBuilder;
- public void buildRemoteRepository( File repositoryDirectory, RepositoryInfo repository, RepositoryBuilderConfigSource configSource )
+ public void buildRemoteRepository( File repositoryDirectory, RepositoryInfo repository,
+ RepositoryBuilderConfigSource configSource )
throws RepositoryAssemblyException
{
MavenProject project = configSource.getProject();
@@ -120,21 +123,22 @@
ArtifactRepository targetRepository = createLocalRepository( repositoryDirectory );
ArtifactResolutionResult result = null;
-
+
Set dependencyArtifacts = project.getDependencyArtifacts();
-
+
if ( dependencyArtifacts == null )
{
Logger logger = getLogger();
-
+
if ( logger.isDebugEnabled() )
{
- logger.debug( "dependency-artifact set for project: " + project.getId() + " is null. Skipping repository processing." );
+ logger.debug( "dependency-artifact set for project: " + project.getId()
+ + " is null. Skipping repository processing." );
}
-
+
return;
}
-
+
try
{
// i have to get everything first as a filter or transformation here
@@ -145,8 +149,8 @@
// JARs.
// FIXME I'm not getting runtime dependencies here
- result = artifactResolver.resolveTransitively( dependencyArtifacts, project.getArtifact(),
- project.getRemoteArtifactRepositories(), localRepository, metadataSource );
+ result = artifactResolver.resolveTransitively( dependencyArtifacts, project.getArtifact(), project
+ .getRemoteArtifactRepositories(), localRepository, metadataSource );
}
catch ( ArtifactResolutionException e )
{
@@ -167,11 +171,12 @@
{
throw new RepositoryAssemblyException( "Error invalidating the processed project cache.", e );
}
-
- ArtifactFilter filter = buildRepositoryFilter( repository, project);
- assembleRepositoryArtifacts( result, filter, project, localRepository, targetRepository, repositoryDirectory, groupVersionAlignments );
-
+ ArtifactFilter filter = buildRepositoryFilter( repository, project );
+
+ assembleRepositoryArtifacts( result, filter, project, localRepository, targetRepository, repositoryDirectory,
+ groupVersionAlignments );
+
ArtifactRepository centralRepository = findCentralRepository( project );
if ( repository.isIncludeMetadata() )
@@ -180,7 +185,7 @@
}
}
- private ArtifactFilter buildRepositoryFilter(RepositoryInfo repository, MavenProject project)
+ private ArtifactFilter buildRepositoryFilter( RepositoryInfo repository, MavenProject project )
{
AndArtifactFilter filter = new AndArtifactFilter();
@@ -239,7 +244,8 @@
private void assembleRepositoryArtifacts( ArtifactResolutionResult result, ArtifactFilter filter,
MavenProject project, ArtifactRepository localRepository,
- ArtifactRepository targetRepository, File repositoryDirectory, Map groupVersionAlignments )
+ ArtifactRepository targetRepository, File repositoryDirectory,
+ Map groupVersionAlignments )
throws RepositoryAssemblyException
{
try
@@ -275,7 +281,8 @@
a = artifactFactory.createProjectArtifact( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject p = projectBuilder.buildFromRepository( a,
- project.getRemoteArtifactRepositories(), localRepository );
+ project.getRemoteArtifactRepositories(),
+ localRepository );
do
{
@@ -298,7 +305,8 @@
writeChecksums( targetFile );
p = p.getParent();
- } while ( p != null );
+ }
+ while ( p != null );
}
}
}
@@ -388,10 +396,12 @@
FileUtils.copyFile( metadataFile, metadataFileRemote );
FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName() + ".sha1" ),
- new File( metadataFileRemote.getParentFile(), metadataFileRemote.getName() + ".sha1" ) );
+ new File( metadataFileRemote.getParentFile(), metadataFileRemote.getName()
+ + ".sha1" ) );
FileUtils.copyFile( new File( metadataFile.getParentFile(), metadataFile.getName() + ".md5" ),
- new File( metadataFileRemote.getParentFile(), metadataFileRemote.getName() + ".md5" ) );
+ new File( metadataFileRemote.getParentFile(), metadataFileRemote.getName()
+ + ".md5" ) );
}
catch ( IOException e )
{
@@ -430,7 +440,7 @@
groupVersionAlignments.put( alignment.getId(), alignment );
}
-
+
return groupVersionAlignments;
}
@@ -451,14 +461,14 @@
}
return createRepository( "local", localRepositoryUrl, false, true,
- ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
+ ArtifactRepositoryPolicy.CHECKSUM_POLICY_WARN );
}
public ArtifactRepository createRepository( String repositoryId, String repositoryUrl, boolean offline,
boolean updateSnapshots, String globalChecksumPolicy )
{
ArtifactRepository localRepository = new DefaultArtifactRepository( repositoryId, repositoryUrl,
- repositoryLayout );
+ repositoryLayout );
boolean snapshotPolicySet = false;
Modified: maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssembler.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssembler.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssembler.java (original)
+++ maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssembler.java Sat Dec 16 07:59:59 2006
@@ -1,25 +1,27 @@
-package org.apache.maven.shared.repository;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-
-import org.apache.maven.shared.repository.model.RepositoryInfo;
+package org.apache.maven.shared.repository;
import java.io.File;
+import org.apache.maven.shared.repository.model.RepositoryInfo;
+
/**
* @author Jason van Zyl
*/
@@ -27,6 +29,7 @@
{
String ROLE = RepositoryAssembler.class.getName();
- public void buildRemoteRepository( File repositoryDirectory, RepositoryInfo repository, RepositoryBuilderConfigSource configSource )
+ public void buildRemoteRepository( File repositoryDirectory, RepositoryInfo repository,
+ RepositoryBuilderConfigSource configSource )
throws RepositoryAssemblyException;
}
Modified: maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssemblyException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssemblyException.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssemblyException.java (original)
+++ maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryAssemblyException.java Sat Dec 16 07:59:59 2006
@@ -1,20 +1,22 @@
-package org.apache.maven.shared.repository;
-
/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
+package org.apache.maven.shared.repository;
/**
* @author Jason van Zyl
Modified: maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryBuilderConfigSource.java
URL: http://svn.apache.org/viewvc/maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryBuilderConfigSource.java?view=diff&rev=487820&r1=487819&r2=487820
==============================================================================
--- maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryBuilderConfigSource.java (original)
+++ maven/sandbox/maven-repository-builder/src/main/java/org/apache/maven/shared/repository/RepositoryBuilderConfigSource.java Sat Dec 16 07:59:59 2006
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
package org.apache.maven.shared.repository;
import org.apache.maven.artifact.repository.ArtifactRepository;
@@ -5,9 +23,9 @@
public interface RepositoryBuilderConfigSource
{
-
+
MavenProject getProject();
-
+
ArtifactRepository getLocalRepository();
}