Collection<String> projectVersions = getVersions( selectedRepos, groupId, artifactId );
repositorySession = repositorySessionFactory.createSession();
MetadataResolver metadataResolver = repositorySession.getResolver();
ProjectVersionMetadata sharedModel = new ProjectVersionMetadata();
MavenProjectFacet mavenFacet = new MavenProjectFacet();
mavenFacet.setGroupId( groupId );
mavenFacet.setArtifactId( artifactId );
sharedModel.addFacet( mavenFacet );
boolean isFirstVersion = true;
for ( String version : projectVersions )
{
ProjectVersionMetadata versionMetadata = null;
for ( String repoId : selectedRepos )
{
if ( versionMetadata == null || versionMetadata.isIncomplete() )
{
try
{
ProjectVersionMetadata projectVersionMetadataResolved = null;
boolean useCache = !StringUtils.endsWith( version, VersionUtil.SNAPSHOT );
String cacheKey = null;
boolean cacheToUpdate = false;
// FIXME a bit maven centric!!!
// not a snapshot so get it from cache
if ( useCache )
{
cacheKey = repoId + groupId + artifactId + version;
projectVersionMetadataResolved = versionMetadataCache.get( cacheKey );
}
if ( useCache && projectVersionMetadataResolved != null )
{
versionMetadata = projectVersionMetadataResolved;
}
else
{
projectVersionMetadataResolved =
metadataResolver.resolveProjectVersion( repositorySession, repoId, groupId,
artifactId, version );
versionMetadata = projectVersionMetadataResolved;
cacheToUpdate = true;
}