public MavenId addArtifact(int indexId, File artifactFile) throws MavenServerIndexerException { try { IndexingContext index = getIndex(indexId); ArtifactContext artifactContext = myArtifactContextProducer.getArtifactContext(index, artifactFile); if (artifactContext == null) return null; addArtifact(myIndexer, index, artifactContext); org.sonatype.nexus.index.ArtifactInfo a = artifactContext.getArtifactInfo(); return new MavenId(a.groupId, a.artifactId, a.version); } catch (Exception e) { throw new MavenServerIndexerException(wrapException(e)); } }
public void artifactDiscovered(ArtifactContext ac) { try { if (p.isCanceled()) throw new ProcessCanceledException(); ArtifactInfo info = ac.getArtifactInfo(); p.setText2(info.groupId + ":" + info.artifactId + ":" + info.version); } catch (RemoteException e) { throw new RuntimeRemoteException(e); } }