Lines 5-10
Link Here
|
5 |
import java.io.File; |
5 |
import java.io.File; |
6 |
import java.io.StringWriter; |
6 |
import java.io.StringWriter; |
7 |
import java.net.URL; |
7 |
import java.net.URL; |
|
|
8 |
import java.util.ArrayList; |
8 |
import java.util.Collections; |
9 |
import java.util.Collections; |
9 |
import java.util.Iterator; |
10 |
import java.util.Iterator; |
10 |
import java.util.List; |
11 |
import java.util.List; |
Lines 361-366
Link Here
|
361 |
} |
362 |
} |
362 |
|
363 |
|
363 |
final Artifact a = ( Artifact) it.next(); |
364 |
final Artifact a = ( Artifact) it.next(); |
|
|
365 |
|
366 |
IClasspathAttribute deployableAttr = null; |
367 |
if (!a.getScope().equalsIgnoreCase("provided") && !a.getScope().equalsIgnoreCase("test")) { |
368 |
deployableAttr = JavaCore.newClasspathAttribute("org.eclipse.jst.j2ee.deployableArtifact", "true"); |
369 |
} |
364 |
|
370 |
|
365 |
monitor.subTask( "Processing " + a.getId() ); |
371 |
monitor.subTask( "Processing " + a.getId() ); |
366 |
String artifactLocation = a.getFile().getAbsolutePath(); |
372 |
String artifactLocation = a.getFile().getAbsolutePath(); |
Lines 382-394
Link Here
|
382 |
continue; |
388 |
continue; |
383 |
} |
389 |
} |
384 |
|
390 |
|
385 |
libraryEntries.add(JavaCore.newProjectEntry(artifactProject.getFullPath(), false)); |
391 |
libraryEntries.add( |
|
|
392 |
JavaCore.newProjectEntry( |
393 |
artifactProject.getFullPath(), |
394 |
new IAccessRule[0], |
395 |
true, |
396 |
deployableAttr != null ? new IClasspathAttribute[]{deployableAttr} : new IClasspathAttribute[0], |
397 |
false)); |
386 |
continue; |
398 |
continue; |
387 |
} |
399 |
} |
388 |
|
400 |
|
389 |
Path srcPath = materializeArtifactPath(mavenProject, a, "java-source", "sources", downloadSources, monitor); |
401 |
Path srcPath = materializeArtifactPath(mavenProject, a, "java-source", "sources", downloadSources, monitor); |
390 |
|
402 |
|
391 |
IClasspathAttribute[] attributes = new IClasspathAttribute[0]; |
403 |
IClasspathAttribute javadocAttr = null; |
392 |
if(srcPath==null) { // no need to search for javadoc if we have source code |
404 |
if(srcPath==null) { // no need to search for javadoc if we have source code |
393 |
Path javadocPath = materializeArtifactPath(mavenProject, a, "java-doc", "javadoc", downloadJavadoc, monitor); |
405 |
Path javadocPath = materializeArtifactPath(mavenProject, a, "java-doc", "javadoc", downloadJavadoc, monitor); |
394 |
String javaDocUrl = null; |
406 |
String javaDocUrl = null; |
Lines 398-410
Link Here
|
398 |
javaDocUrl = getJavaDocUrl(artifactLocation, monitor); |
410 |
javaDocUrl = getJavaDocUrl(artifactLocation, monitor); |
399 |
} |
411 |
} |
400 |
if(javaDocUrl!=null) { |
412 |
if(javaDocUrl!=null) { |
401 |
attributes = new IClasspathAttribute[] { |
413 |
javadocAttr = |
402 |
JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, javaDocUrl)}; |
414 |
JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, javaDocUrl); |
403 |
} |
415 |
} |
404 |
} |
416 |
} |
405 |
|
417 |
|
406 |
libraryEntries.add(JavaCore.newLibraryEntry(new Path(artifactLocation), srcPath, null, |
418 |
List attributes = new ArrayList(); |
407 |
new IAccessRule[0], attributes, false /*not exported*/)); |
419 |
if (javadocAttr != null) attributes.add(javadocAttr); |
|
|
420 |
if (deployableAttr != null) attributes.add(deployableAttr); |
421 |
IClasspathAttribute[] attrs = (IClasspathAttribute[]) attributes.toArray(new IClasspathAttribute[attributes.size()]); |
422 |
|
423 |
libraryEntries.add( |
424 |
JavaCore.newLibraryEntry( |
425 |
new Path(artifactLocation), srcPath, null, |
426 |
new IAccessRule[0], |
427 |
attrs, |
428 |
false /*not exported*/)); |
408 |
} |
429 |
} |
409 |
} |
430 |
} |
410 |
|
431 |
|