mirror of https://github.com/apache/maven.git
Add a little tool for check all poms in repo.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@220028 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2259cea946
commit
fc6efd7175
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven</artifactId>
|
||||
<version>2.0-beta-1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>maven-repository-checker</artifactId>
|
||||
<name>Maven Repository Checker</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-model</artifactId>
|
||||
<version>2.0-beta-1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,74 @@
|
|||
package org.apache.maven.repository.checker;
|
||||
|
||||
/*
|
||||
* Copyright 2004-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.model.io.xpp3.MavenXpp3Reader;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
|
||||
public class CheckRepo
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
if ( args.length != 1 )
|
||||
{
|
||||
System.out.println( "Usage: " + CheckRepo.class.getName() + " <repository path>" );
|
||||
System.exit( 1 );
|
||||
}
|
||||
|
||||
File rootDir = new File( args[0] );
|
||||
if ( !rootDir.exists() )
|
||||
{
|
||||
System.out.println( rootDir.getAbsolutePath() + " doesn't exist." );
|
||||
|
||||
System.exit( 1 );
|
||||
}
|
||||
|
||||
String[] extensions = { "pom" };
|
||||
|
||||
String[] files = FileUtils.getFilesFromExtension( rootDir.getAbsolutePath(), extensions );
|
||||
|
||||
for ( int i = 0; i < files.length; i++ )
|
||||
{
|
||||
//System.out.println( files[i] );
|
||||
parseFile( new File( files[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
private static void parseFile( File file )
|
||||
{
|
||||
try
|
||||
{
|
||||
FileReader fileReader = new FileReader( file );
|
||||
|
||||
MavenXpp3Reader reader = new MavenXpp3Reader();
|
||||
|
||||
reader.read( fileReader );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
System.out.println( "================================================" );
|
||||
|
||||
System.out.println( file.getAbsolutePath() );
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
System.out.println( "================================================" );
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue