versioning - versions-maven-plugin doesn't retrieve the latest version on nexus? -
i trying use (partly successfully) versions-maven-plugin retrieve latest release/snapshot versions local and nexus repositories update maven projects. when running plugin update versions, have noticed following behaviour:
even though know there newer version in nexus, not in local repository, doesn't find latest version, latest local repo. if delete maven-metadata*.xml files local repo artifact want update, downloads latest maven-metadata*.xml files , correctly finds latest version.
i see it's using 2.0.6 og maven apis, , method drives whole update mechanism retrieveavailableversions() interface artifactmetadatasource , implemented mavenmetadatasource.
my question how can alter code of plugin download latest maven-metadata*.xml files such latest versions? or if there other reliable method can make happen..
thanks time.
i have found solution myself , created goal run before running goals updates pom.xml files: method updates metadata repositories. if need whole goals, please let me know:
public void updatemetadata(artifact artifact){ getlog().info("updating metadata for: " + artifact.getgroupid()+":"+artifact.getartifactid()); repositorymetadata metadata = new artifactrepositorymetadata( artifact); ( iterator<artifactrepository> repo = remoteartifactrepositories.iterator(); repo.hasnext(); ){ artifactrepository repository = repo.next(); artifactrepositorypolicy policy = metadata.issnapshot() ? repository.getsnapshots() : repository.getreleases(); file file = new file( localrepository.getbasedir(), localrepository.pathoflocalrepositorymetadata( metadata, repository ) ); getlog().info("updating " + repository.getbasedir()); try { wagonmanager.getartifactmetadata( metadata, repository, file, policy.getchecksumpolicy()); getlog().info("updated..."); } catch (transferfailedexception e) { getlog().info("couldn't find " + metadata + " repository: " + repository.getid() + "\n reason\n: " + e.getmessage() ); e.printstacktrace(); } catch (resourcedoesnotexistexception e) { getlog().info("cannot find " + metadata + " in repository: " + repository.getid() ); if ( file.exists() ){ file.delete(); } e.printstacktrace(); } } }
Comments
Post a Comment