mirror of https://github.com/apache/maven.git
update copyright, reformat and optimize imports.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290064 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ab13ed39f3
commit
7650eb09a3
|
@ -30,17 +30,17 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0-beta-1-SNAPSHOT</version>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0-beta-1-SNAPSHOT</version>
|
||||
<version>2.0-beta-1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>2.0-beta-1-SNAPSHOT</version>
|
||||
<version>2.0-beta-1</version>
|
||||
<classifier>all</classifier>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package org.apache.maven.tools.repoclean;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
/*
|
||||
* 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 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.codehaus.classworlds.ClassWorld;
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
package org.apache.maven.tools.repoclean;
|
||||
|
||||
/*
|
||||
* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
* 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 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.repository.ArtifactRepository;
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
package org.apache.maven.tools.repoclean;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
package org.apache.maven.tools.repoclean;/*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
package org.apache.maven.tools.repoclean.digest;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
package org.apache.maven.tools.repoclean.digest;/*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
package org.apache.maven.tools.repoclean.digest;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
package org.apache.maven.tools.repoclean.digest;/*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package org.apache.maven.tools.repoclean.digest;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
/*
|
||||
* 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 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.tools.repoclean.report.ReportWriteException;
|
||||
|
@ -41,7 +40,7 @@ public class DigestVerifier
|
|||
}
|
||||
|
||||
public void verifyDigest( File source, File target, RewriteTransaction transaction, Reporter reporter,
|
||||
boolean reportOnly )
|
||||
boolean reportOnly )
|
||||
throws DigestException, ReportWriteException, IOException
|
||||
{
|
||||
verifyDigestFile( source, target, transaction, reporter, reportOnly, ".md5", Digestor.MD5 );
|
||||
|
@ -50,7 +49,7 @@ public class DigestVerifier
|
|||
}
|
||||
|
||||
private void verifyDigestFile( File artifactSource, File artifactTarget, RewriteTransaction transaction,
|
||||
Reporter reporter, boolean reportOnly, String digestExt, String digestAlgorithm )
|
||||
Reporter reporter, boolean reportOnly, String digestExt, String digestAlgorithm )
|
||||
throws DigestException, ReportWriteException, IOException
|
||||
{
|
||||
// create the digest source file from which to copy/verify.
|
||||
|
@ -67,7 +66,7 @@ public class DigestVerifier
|
|||
if ( artifactTarget != null )
|
||||
{
|
||||
digestTargetFile = new File( artifactTarget + digestExt );
|
||||
|
||||
|
||||
transaction.addFile( digestTargetFile );
|
||||
}
|
||||
|
||||
|
@ -88,8 +87,8 @@ public class DigestVerifier
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
reporter.error( "Cannot copy digest file for path [" + artifactSource
|
||||
+ "] from source to target for digest algorithm: \'" + digestAlgorithm + "\'.", e );
|
||||
reporter.error( "Cannot copy digest file for path [" + artifactSource +
|
||||
"] from source to target for digest algorithm: \'" + digestAlgorithm + "\'.", e );
|
||||
|
||||
throw e;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,21 @@
|
|||
/* Created on Sep 20, 2004 */
|
||||
package org.apache.maven.tools.repoclean.digest;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
|
@ -76,8 +91,8 @@ public class Digestor
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new DigestException( "Cannot verify digest for artifact file: \'" + artifactFile
|
||||
+ "\' against digest file: \'" + digestFile + "\' using algorithm: \'" + algorithm + "\'", e );
|
||||
throw new DigestException( "Cannot verify digest for artifact file: \'" + artifactFile +
|
||||
"\' against digest file: \'" + digestFile + "\' using algorithm: \'" + algorithm + "\'", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
package org.apache.maven.tools.repoclean.discover;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.factory.ArtifactFactory;
|
||||
import org.apache.maven.tools.repoclean.report.PathLister;
|
||||
|
@ -12,20 +28,6 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
|
|
|
@ -3,15 +3,17 @@ package org.apache.maven.tools.repoclean.discover;
|
|||
/*
|
||||
* 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 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;
|
||||
|
|
|
@ -1,17 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.index;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -28,6 +16,18 @@ import java.util.List;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
|
|
|
@ -1,21 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.phase;
|
||||
|
||||
import org.apache.maven.tools.repoclean.RepositoryCleanerConfiguration;
|
||||
import org.apache.maven.tools.repoclean.discover.ArtifactDiscoverer;
|
||||
import org.apache.maven.tools.repoclean.report.PathLister;
|
||||
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
import org.codehaus.plexus.context.ContextException;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -32,6 +16,22 @@ import java.util.List;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.tools.repoclean.RepositoryCleanerConfiguration;
|
||||
import org.apache.maven.tools.repoclean.discover.ArtifactDiscoverer;
|
||||
import org.apache.maven.tools.repoclean.report.PathLister;
|
||||
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||
import org.codehaus.plexus.PlexusConstants;
|
||||
import org.codehaus.plexus.PlexusContainer;
|
||||
import org.codehaus.plexus.context.Context;
|
||||
import org.codehaus.plexus.context.ContextException;
|
||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||
import org.codehaus.plexus.logging.Logger;
|
||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DiscoveryPhase
|
||||
extends AbstractLogEnabled
|
||||
implements Contextualizable
|
||||
|
|
|
@ -267,7 +267,8 @@ public class RewritePhase
|
|||
|
||||
transaction.addFile( targetPom );
|
||||
|
||||
bridgedTargetPom = new File( targetBase, bridgingLayout.pathOfArtifactMetadata( pom ).replace( '+', '-' ) );
|
||||
bridgedTargetPom = new File( targetBase,
|
||||
bridgingLayout.pathOfArtifactMetadata( pom ).replace( '+', '-' ) );
|
||||
|
||||
transaction.addFile( bridgedTargetPom );
|
||||
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package org.apache.maven.tools.repoclean.report;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
/*
|
||||
* 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 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.codehaus.plexus.util.IOUtil;
|
||||
|
@ -55,7 +54,7 @@ public class FileReporter
|
|||
public FileReporter( File reportsBase, String reportPath, boolean warningsEnabled )
|
||||
{
|
||||
this.warningsEnabled = warningsEnabled;
|
||||
|
||||
|
||||
this.reportsFile = new File( reportsBase, reportPath );
|
||||
|
||||
File parentDir = reportsFile.getParentFile();
|
||||
|
@ -66,9 +65,9 @@ public class FileReporter
|
|||
|
||||
if ( !parentDir.isDirectory() )
|
||||
{
|
||||
throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath()
|
||||
+ "\' refers to a file, not a directory.\n" + "Cannot write report file: \'"
|
||||
+ reportsFile.getAbsolutePath() + "\'." );
|
||||
throw new IllegalArgumentException( "path: \'" + parentDir.getAbsolutePath() +
|
||||
"\' refers to a file, not a directory.\n" + "Cannot write report file: \'" +
|
||||
reportsFile.getAbsolutePath() + "\'." );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,7 +129,7 @@ public class FileReporter
|
|||
public void warn( String message )
|
||||
throws ReportWriteException
|
||||
{
|
||||
if( warningsEnabled )
|
||||
if ( warningsEnabled )
|
||||
{
|
||||
hasWarning = true;
|
||||
String source = getSourceLine();
|
||||
|
@ -157,10 +156,11 @@ public class FileReporter
|
|||
private String getSourceLine()
|
||||
{
|
||||
NullPointerException npe = new NullPointerException();
|
||||
|
||||
|
||||
StackTraceElement element = npe.getStackTrace()[2];
|
||||
|
||||
return " Reported from: (" + element.getClassName() + "." + element.getMethodName() + "(..):" + element.getLineNumber() + ")\n";
|
||||
|
||||
return " Reported from: (" + element.getClassName() + "." + element.getMethodName() + "(..):" +
|
||||
element.getLineNumber() + ")\n";
|
||||
}
|
||||
|
||||
private CharSequence format( List messageParts )
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.report;
|
||||
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -23,6 +16,13 @@ import java.io.Writer;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
public class PathLister
|
||||
{
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.tools.repoclean.report;
|
||||
|
||||
/*
|
||||
package org.apache.maven.tools.repoclean.report;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.tools.repoclean.report;
|
||||
|
||||
/*
|
||||
package org.apache.maven.tools.repoclean.report;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
package org.apache.maven.tools.repoclean.rewrite;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 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.
|
||||
* ====================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author jdcasey
|
||||
*/
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
package org.apache.maven.tools.repoclean.rewrite;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
/*
|
||||
* 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 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;
|
||||
|
@ -38,7 +37,7 @@ public class V4PomRewriter
|
|||
{
|
||||
Model model = null;
|
||||
|
||||
if( from != null )
|
||||
if ( from != null )
|
||||
{
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.transaction;
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -23,6 +16,13 @@ import java.util.List;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class RewriteTransaction
|
||||
{
|
||||
|
||||
|
@ -48,8 +48,8 @@ public class RewriteTransaction
|
|||
File file = (File) it.next();
|
||||
if ( file.exists() && !file.delete() )
|
||||
{
|
||||
throw new RollbackException( "[rollback] Cannot delete file: " + file
|
||||
+ "\nPart of transaction for artifact: {" + artifact.getId() + "}." );
|
||||
throw new RollbackException( "[rollback] Cannot delete file: " + file +
|
||||
"\nPart of transaction for artifact: {" + artifact.getId() + "}." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.tools.repoclean.transaction;
|
||||
|
||||
/*
|
||||
package org.apache.maven.tools.repoclean.transaction;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
package org.apache.maven.tools.repoclean.translate;
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
package org.apache.maven.tools.repoclean.translate;/*
|
||||
* 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 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -19,6 +16,9 @@ import java.net.URL;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
|
||||
public final class TestSupport
|
||||
{
|
||||
|
||||
|
@ -74,9 +74,9 @@ public final class TestSupport
|
|||
public static File getResource( String relativePath )
|
||||
{
|
||||
ClassLoader cloader = TestSupport.class.getClassLoader();
|
||||
|
||||
|
||||
URL resource = cloader.getResource( relativePath );
|
||||
|
||||
|
||||
return new File( resource.getPath() ).getAbsoluteFile();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.digest;
|
||||
|
||||
import org.apache.maven.tools.repoclean.TestSupport;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Arrays;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -24,58 +16,66 @@ import junit.framework.TestCase;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.maven.tools.repoclean.TestSupport;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ArtifactDigestorTest
|
||||
extends TestCase
|
||||
{
|
||||
|
||||
|
||||
private static final String DIGEST_FORMAT_VERIFY_ARTIFACT = "digestFormatVerifyArtifact.jar";
|
||||
|
||||
public void testShouldWriteDigestFileInHexNotBinary() throws Exception
|
||||
|
||||
public void testShouldWriteDigestFileInHexNotBinary()
|
||||
throws Exception
|
||||
{
|
||||
Digestor digestor = new Digestor();
|
||||
|
||||
File artifact = TestSupport.getMyResource(this, DIGEST_FORMAT_VERIFY_ARTIFACT);
|
||||
|
||||
|
||||
File artifact = TestSupport.getMyResource( this, DIGEST_FORMAT_VERIFY_ARTIFACT );
|
||||
|
||||
byte[] rawDigest = digestor.generateArtifactDigest( artifact, Digestor.MD5 );
|
||||
|
||||
StringBuffer rawConverted = new StringBuffer(rawDigest.length * 2);
|
||||
|
||||
StringBuffer rawConverted = new StringBuffer( rawDigest.length * 2 );
|
||||
for ( int i = 0; i < rawDigest.length; i++ )
|
||||
{
|
||||
String encoded = Integer.toHexString(rawDigest[i] & 0xff);
|
||||
if(encoded.length() < 2)
|
||||
String encoded = Integer.toHexString( rawDigest[i] & 0xff );
|
||||
if ( encoded.length() < 2 )
|
||||
{
|
||||
encoded = "0" + encoded;
|
||||
}
|
||||
|
||||
rawConverted.append(encoded);
|
||||
|
||||
rawConverted.append( encoded );
|
||||
}
|
||||
|
||||
File digestFile = File.createTempFile("repoclean-artifactDigest-formatTest", ".md5");
|
||||
|
||||
|
||||
File digestFile = File.createTempFile( "repoclean-artifactDigest-formatTest", ".md5" );
|
||||
|
||||
digestor.createArtifactDigest( artifact, digestFile, Digestor.MD5 );
|
||||
|
||||
FileReader reader = new FileReader(digestFile);
|
||||
StringBuffer written = new StringBuffer(rawDigest.length * 2);
|
||||
|
||||
|
||||
FileReader reader = new FileReader( digestFile );
|
||||
StringBuffer written = new StringBuffer( rawDigest.length * 2 );
|
||||
|
||||
char[] cbuf = new char[rawDigest.length * 2];
|
||||
int read = -1;
|
||||
|
||||
while((read = reader.read(cbuf)) > -1)
|
||||
|
||||
while ( ( read = reader.read( cbuf ) ) > -1 )
|
||||
{
|
||||
written.append(cbuf, 0, read);
|
||||
written.append( cbuf, 0, read );
|
||||
}
|
||||
|
||||
|
||||
reader.close();
|
||||
|
||||
assertEquals(rawConverted.length(), written.length());
|
||||
|
||||
|
||||
assertEquals( rawConverted.length(), written.length() );
|
||||
|
||||
cbuf = new char[written.length()];
|
||||
char[] cbuf2 = new char[cbuf.length];
|
||||
|
||||
written.getChars(0, cbuf.length, cbuf, 0);
|
||||
rawConverted.getChars(0, cbuf2.length, cbuf2, 0);
|
||||
|
||||
assertTrue(Arrays.equals(cbuf, cbuf2));
|
||||
|
||||
written.getChars( 0, cbuf.length, cbuf, 0 );
|
||||
rawConverted.getChars( 0, cbuf2.length, cbuf2, 0 );
|
||||
|
||||
assertTrue( Arrays.equals( cbuf, cbuf2 ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
package org.apache.maven.tools.repoclean.report;
|
||||
|
||||
/*
|
||||
package org.apache.maven.tools.repoclean.report;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package org.apache.maven.tools.repoclean.translate;
|
||||
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.tools.repoclean.report.DummyReporter;
|
||||
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -24,6 +16,14 @@ import org.codehaus.plexus.PlexusTestCase;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.model.Build;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.model.Model;
|
||||
import org.apache.maven.model.Plugin;
|
||||
import org.apache.maven.tools.repoclean.report.DummyReporter;
|
||||
import org.apache.maven.tools.repoclean.report.Reporter;
|
||||
import org.codehaus.plexus.PlexusTestCase;
|
||||
|
||||
public class PomV3ToV4TranslatorTest
|
||||
extends PlexusTestCase
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue