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


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163988 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-04-20 22:10:24 +00:00
parent 6003f258b3
commit 84e67faf30
2 changed files with 31 additions and 18 deletions

View File

@ -39,8 +39,7 @@ public interface ArtifactDiscoverer
"**/.htaccess",
"**/*.html",
"**/*.asc",
"**/*.txt",
"**/REPOSITORY-V*.txt"
"**/*.txt"
};
List discoverArtifacts( File repositoryBase, FileReporter reporter ) throws Exception;

View File

@ -124,18 +124,32 @@ public class LegacyArtifactDiscoverer
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 );
avceTokenList.addLast( lastAvceToken );
}
else
{
reporter
.warn( "Artifact path: \'"
+ path
+ "\' does not match naming convention. Cannot reliably extract artifact information from path." );
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 @@ public class LegacyArtifactDiscoverer
}
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;
}