jdcasey 2005/04/20 15:10:24
Modified:
sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover
ArtifactDiscoverer.java
LegacyArtifactDiscoverer.java
Log:
o Added support for weeding out potential artifacts that don't have an
extension matching the '...s' pattern in the legacy layout (eg. things in
'/jars/' that don't have a .jar extension).
o Added artifacts to my local testing repository (which I will be sync'ing
with the one on beaver) to satisfy the dotted groupId, the no-extension test,
the '.txt' extension test.
o not sure what to do with the last test-case in MNG-312, though, given that
I thought we decided not to convert distributions, and the classifiers
currently only happen in distros. Will take this discussion to jira, though.
PR: MNG-312
Revision Changes Path
1.5 +1 -2
maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java
Index: ArtifactDiscoverer.java
===================================================================
RCS file:
/home/cvs/maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/ArtifactDiscoverer.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ArtifactDiscoverer.java 19 Apr 2005 20:05:15 -0000 1.4
+++ ArtifactDiscoverer.java 20 Apr 2005 22:10:24 -0000 1.5
@@ -39,8 +39,7 @@
"**/.htaccess",
"**/*.html",
"**/*.asc",
- "**/*.txt",
- "**/REPOSITORY-V*.txt"
+ "**/*.txt"
};
List discoverArtifacts( File repositoryBase, FileReporter reporter )
throws Exception;
1.9 +30 -16
maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java
Index: LegacyArtifactDiscoverer.java
===================================================================
RCS file:
/home/cvs/maven-components/sandbox/repoclean/src/main/java/org/apache/maven/tools/repoclean/discover/LegacyArtifactDiscoverer.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LegacyArtifactDiscoverer.java 19 Apr 2005 20:05:15 -0000 1.8
+++ LegacyArtifactDiscoverer.java 20 Apr 2005 22:10:24 -0000 1.9
@@ -124,18 +124,32 @@
if ( extPos > 0 )
{
- lastAvceToken = lastAvceToken.substring( 0, extPos );
- }
+ String ext = lastAvceToken.substring( extPos + 1 );
+ if ( type.equals( ext ) )
+ {
+ lastAvceToken = lastAvceToken.substring( 0, extPos );
+
+ avceTokenList.addLast( lastAvceToken );
+ }
+ else
+ {
+ reporter
+ .warn( "Artifact path: \'"
+ + path
+ + "\' does not match naming convention. Cannot
reliably extract artifact information from path." );
- avceTokenList.addLast( lastAvceToken );
+ return null;
+ }
+ }
}
- String validVersionParts = "([Dd][Ee][Vv][_.0-9]*)|" +
"([Ss][Nn][Aa][Pp][Ss][Hh][Oo][Tt])|" + "([0-9][_.0-9a-zA-Z]*)|"
- + "([Gg]?[_.0-9ab]*([Pp][Rr][Ee]|[Rr][Cc]|[Gg]|[Mm])[_.0-9]*)|"
+ "([Aa][Ll][Pp][Hh][Aa][_.0-9]*)|"
- + "([Bb][Ee][Tt][Aa][_.0-9]*)|" + "([Rr][Cc][_.0-9]*)|" +
"([Tt][Ee][Ss][Tt][_.0-9]*)|"
- + "([Dd][Ee][Bb][Uu][Gg][_.0-9]*)|" +
"([Uu][Nn][Oo][Ff][Ff][Ii][Cc][Ii][Aa][Ll][_.0-9]*)|"
- + "([Cc][Uu][Rr][Rr][Ee][Nn][Tt])|" +
"([Ll][Aa][Tt][Ee][Ss][Tt])|" + "([Ff][Cc][Ss])|"
- + "([Rr][Ee][Ll][Ee][Aa][Ss][Ee][_.0-9]*)|" +
"([Nn][Ii][Gg][Hh][Tt][Ll][Yy])";
+ String validVersionParts = "([Dd][Ee][Vv][_.0-9]*)|" +
"([Ss][Nn][Aa][Pp][Ss][Hh][Oo][Tt])|"
+ + "([0-9][_.0-9a-zA-Z]*)|" +
"([Gg]?[_.0-9ab]*([Pp][Rr][Ee]|[Rr][Cc]|[Gg]|[Mm])[_.0-9]*)|"
+ + "([Aa][Ll][Pp][Hh][Aa][_.0-9]*)|" +
"([Bb][Ee][Tt][Aa][_.0-9]*)|" + "([Rr][Cc][_.0-9]*)|"
+ + "([Tt][Ee][Ss][Tt][_.0-9]*)|" +
"([Dd][Ee][Bb][Uu][Gg][_.0-9]*)|"
+ + "([Uu][Nn][Oo][Ff][Ff][Ii][Cc][Ii][Aa][Ll][_.0-9]*)|" +
"([Cc][Uu][Rr][Rr][Ee][Nn][Tt])|"
+ + "([Ll][Aa][Tt][Ee][Ss][Tt])|" + "([Ff][Cc][Ss])|" +
"([Rr][Ee][Ll][Ee][Aa][Ss][Ee][_.0-9]*)|"
+ + "([Nn][Ii][Gg][Hh][Tt][Ll][Yy])";
// let's discover the version, and whatever's leftover will be either
// a classifier, or part of the artifactId, depending on position.
@@ -211,16 +225,16 @@
}
String artifactId = artifactIdBuffer.toString();
-
- int lastVersionCharIdx = versionBuffer.length() -1;
- if(lastVersionCharIdx > -1 &&
versionBuffer.charAt(lastVersionCharIdx) == '-')
+
+ int lastVersionCharIdx = versionBuffer.length() - 1;
+ if ( lastVersionCharIdx > -1 && versionBuffer.charAt(
lastVersionCharIdx ) == '-' )
{
- versionBuffer.setLength(lastVersionCharIdx);
+ versionBuffer.setLength( lastVersionCharIdx );
}
-
+
String version = versionBuffer.toString();
-
- if(version.length() < 1)
+
+ if ( version.length() < 1 )
{
version = null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]