@Override public URI[] getArtifactLocations() { return impl.getArtifactLocations(); }
private static File findTargetArtifact(Project p) { AntArtifactProvider prov = p.getLookup().lookup(AntArtifactProvider.class); for (AntArtifact a : prov.getBuildArtifacts()) { if (JavaProjectConstants.ARTIFACT_TYPE_JAR.equals(a.getType())) { for (URI uri : a.getArtifactLocations()) { //XXX check if it is a relative URI try { return new File(uri); } catch (Exception e) { FileObject pdir = p.getProjectDirectory(); try { String url = pdir.getURL().toURI().toString(); if (!url.endsWith("/") && !uri.toString().startsWith("/")) { //NOI18N url += "/"; //NOI18N } URI fullUri = new URI(url + uri); return new File(fullUri); } catch (Exception ex) { throw new IllegalStateException ("Could not find " + //NOI18N "target artifact from project in " + //NOI18N p.getProjectDirectory().getPath() +":" + uri, //NOI18N ex); } } } } } return null; }
/** * Set up GUI fields according to the requested project. * @param project a subproject, or null */ private void populateAccessory( Project project ) { DefaultListModel model = (DefaultListModel)jListArtifacts.getModel(); model.clear(); jTextFieldName.setText(project == null ? "" : ProjectUtils.getInformation(project).getDisplayName()); //NOI18N if ( project != null ) { List<AntArtifact> artifacts = new ArrayList<AntArtifact>(); for (int i=0; i<artifactTypes.length; i++) { artifacts.addAll (Arrays.asList(AntArtifactQuery.findArtifactsByType(project, artifactTypes[i]))); } for(AntArtifact artifact : artifacts) { URI uris[] = artifact.getArtifactLocations(); for( int y = 0; y < uris.length; y++ ) { model.addElement( new ArtifactItem(artifact, uris[y])); } } jListArtifacts.setSelectionInterval(0, model.size()); } }
for (URI artifactURI : item.getArtifact().getArtifactLocations()) { File file = null; if (artifactURI.isAbsolute()) {
ProjectClassPathModifier.addAntArtifacts(new AntArtifact[] {target}, new URI[] {target.getArtifactLocations()[0].normalize()}, referencingFile, ClassPath.COMPILE); } catch (IOException ioe) { Exceptions.printStackTrace(ioe);
names = moduleJarTarget.getArtifactLocations()[0].getPath().split("/"); //NOI18N
List<URI> allURI = new ArrayList<URI>(); for(AntArtifact artifact : artifacts) { allURI.addAll(Arrays.asList(artifact.getArtifactLocations()));
ProjectClassPathModifier.addAntArtifacts(new AntArtifact[] {moduleJarTarget}, new URI[] {moduleJarTarget.getArtifactLocations()[0]}, referencingFile, ClassPath.COMPILE); } catch (IOException ioe) { Exceptions.printStackTrace(ioe);
names = moduleJarTarget.getArtifactLocations()[0].getPath().split("/"); //NOI18N try { ProjectClassPathModifier.addAntArtifacts(new AntArtifact[]{moduleJarTarget}, new URI[]{moduleJarTarget.getArtifactLocations()[0]}, webProject.getSourceRoots().getRoots()[0], ClassPath.COMPILE); } catch (IOException ioe) { Exceptions.printStackTrace(ioe);