1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.maven.plugin.eclipse; |
20 | |
|
21 | |
import java.io.File; |
22 | |
import java.io.FileOutputStream; |
23 | |
import java.io.IOException; |
24 | |
import java.io.InputStream; |
25 | |
import java.io.OutputStream; |
26 | |
import java.util.ArrayList; |
27 | |
import java.util.Arrays; |
28 | |
import java.util.Iterator; |
29 | |
import java.util.LinkedHashSet; |
30 | |
import java.util.LinkedList; |
31 | |
import java.util.List; |
32 | |
import java.util.ListIterator; |
33 | |
import java.util.Map; |
34 | |
import java.util.Set; |
35 | |
|
36 | |
import org.apache.maven.artifact.Artifact; |
37 | |
import org.apache.maven.artifact.handler.ArtifactHandler; |
38 | |
import org.apache.maven.model.Build; |
39 | |
import org.apache.maven.model.Plugin; |
40 | |
import org.apache.maven.model.Resource; |
41 | |
import org.apache.maven.plugin.MojoExecutionException; |
42 | |
import org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations; |
43 | |
import org.apache.maven.plugin.eclipse.writers.EclipseAjdtWriter; |
44 | |
import org.apache.maven.plugin.eclipse.writers.EclipseClasspathWriter; |
45 | |
import org.apache.maven.plugin.eclipse.writers.EclipseManifestWriter; |
46 | |
import org.apache.maven.plugin.eclipse.writers.EclipseOSGiManifestWriter; |
47 | |
import org.apache.maven.plugin.eclipse.writers.EclipseProjectWriter; |
48 | |
import org.apache.maven.plugin.eclipse.writers.EclipseSettingsWriter; |
49 | |
import org.apache.maven.plugin.eclipse.writers.EclipseWriterConfig; |
50 | |
import org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpApplicationXMLWriter; |
51 | |
import org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponent15Writer; |
52 | |
import org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpComponentWriter; |
53 | |
import org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpFacetsWriter; |
54 | |
import org.apache.maven.plugin.eclipse.writers.wtp.EclipseWtpmodulesWriter; |
55 | |
import org.apache.maven.plugin.ide.AbstractIdeSupportMojo; |
56 | |
import org.apache.maven.plugin.ide.IdeDependency; |
57 | |
import org.apache.maven.plugin.ide.IdeUtils; |
58 | |
import org.apache.maven.plugin.ide.JeeUtils; |
59 | |
import org.apache.maven.project.MavenProject; |
60 | |
import org.codehaus.plexus.resource.ResourceManager; |
61 | |
import org.codehaus.plexus.resource.loader.FileResourceLoader; |
62 | |
import org.codehaus.plexus.resource.loader.ResourceNotFoundException; |
63 | |
import org.codehaus.plexus.util.FileUtils; |
64 | |
import org.codehaus.plexus.util.IOUtil; |
65 | |
import org.codehaus.plexus.util.StringUtils; |
66 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
|
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
|
82 | |
|
83 | |
|
84 | |
|
85 | 20 | public class EclipsePlugin |
86 | |
extends AbstractIdeSupportMojo |
87 | |
{ |
88 | |
private static final String WEAVE_DEPENDENCY = "weaveDependency"; |
89 | |
|
90 | |
private static final String WEAVE_DEPENDENCIES = "weaveDependencies"; |
91 | |
|
92 | |
private static final String ASPECT_LIBRARY = "aspectLibrary"; |
93 | |
|
94 | |
private static final String ASPECT_LIBRARIES = "aspectLibraries"; |
95 | |
|
96 | |
private static final String ASPECT_DIRECTORY = "aspectDirectory"; |
97 | |
|
98 | |
private static final String TEST_ASPECT_DIRECTORY = "testAspectDirectory"; |
99 | |
|
100 | |
private static final String ASPECTJ_MAVEN_PLUGIN = "aspectj-maven-plugin"; |
101 | |
|
102 | |
private static final String ORG_CODEHAUS_MOJO = "org.codehaus.mojo"; |
103 | |
|
104 | |
private static final String DEFAULT_TEST_ASPECT_DIRECTORY = "src/test/aspect"; |
105 | |
|
106 | |
private static final String DEFAULT_ASPECT_DIRECTORY = "src/main/aspect"; |
107 | |
|
108 | |
private static final String NATURE_WST_FACET_CORE_NATURE = "org.eclipse.wst.common.project.facet.core.nature"; |
109 | |
|
110 | |
private static final String BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER = |
111 | |
"org.eclipse.wst.common.modulecore.ComponentStructuralBuilderDependencyResolver"; |
112 | |
|
113 | |
protected static final String BUILDER_WST_VALIDATION = "org.eclipse.wst.validation.validationbuilder"; |
114 | |
|
115 | |
private static final String BUILDER_JDT_CORE_JAVA = "org.eclipse.jdt.core.javabuilder"; |
116 | |
|
117 | |
private static final String BUILDER_WST_COMPONENT_STRUCTURAL = |
118 | |
"org.eclipse.wst.common.modulecore.ComponentStructuralBuilder"; |
119 | |
|
120 | |
private static final String BUILDER_WST_FACET = "org.eclipse.wst.common.project.facet.core.builder"; |
121 | |
|
122 | |
private static final String BUILDER_PDE_MANIFEST = "org.eclipse.pde.ManifestBuilder"; |
123 | |
|
124 | |
private static final String BUILDER_PDE_SCHEMA = "org.eclipse.pde.SchemaBuilder"; |
125 | |
|
126 | |
private static final String BUILDER_AJDT_CORE_JAVA = "org.eclipse.ajdt.core.ajbuilder"; |
127 | |
|
128 | |
private static final String NATURE_WST_MODULE_CORE_NATURE = "org.eclipse.wst.common.modulecore.ModuleCoreNature"; |
129 | |
|
130 | |
private static final String NATURE_JDT_CORE_JAVA = "org.eclipse.jdt.core.javanature"; |
131 | |
|
132 | |
private static final String NATURE_JEM_WORKBENCH_JAVA_EMF = "org.eclipse.jem.workbench.JavaEMFNature"; |
133 | |
|
134 | |
private static final String NATURE_PDE_PLUGIN = "org.eclipse.pde.PluginNature"; |
135 | |
|
136 | |
private static final String NATURE_AJDT_CORE_JAVA = "org.eclipse.ajdt.ui.ajnature"; |
137 | |
|
138 | |
protected static final String COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER = "org.eclipse.jdt.launching.JRE_CONTAINER"; |
139 | |
|
140 | |
protected static final String ASPECTJ_RT_CONTAINER = "org.eclipse.ajdt.core.ASPECTJRT_CONTAINER"; |
141 | |
|
142 | |
protected static final String REQUIRED_PLUGINS_CONTAINER = "org.eclipse.pde.core.requiredPlugins"; |
143 | |
|
144 | |
|
145 | 4 | public static final String[] WTP_SUPPORTED_VERSIONS = new String[] { "1.0", "1.5", "2.0", "R7", "none" }; |
146 | |
|
147 | |
|
148 | |
|
149 | |
|
150 | |
private static final String POM_ELT_ARTIFACT_ID = "artifactId"; |
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
private static final String POM_ELT_GROUP_ID = "groupId"; |
156 | |
|
157 | |
|
158 | |
|
159 | |
|
160 | |
|
161 | |
|
162 | |
|
163 | |
|
164 | |
|
165 | |
|
166 | |
|
167 | |
|
168 | |
|
169 | |
|
170 | |
private List projectnatures; |
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
|
178 | |
|
179 | |
private List excludes; |
180 | |
|
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
|
190 | |
|
191 | |
|
192 | |
private List additionalProjectnatures; |
193 | |
|
194 | |
|
195 | |
|
196 | |
|
197 | |
|
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
private Map additionalProjectFacets; |
206 | |
|
207 | |
|
208 | |
|
209 | |
|
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
private List buildcommands; |
226 | |
|
227 | |
|
228 | |
|
229 | |
|
230 | |
|
231 | |
|
232 | |
|
233 | |
|
234 | |
|
235 | |
|
236 | |
|
237 | |
|
238 | |
|
239 | |
|
240 | |
|
241 | |
|
242 | |
|
243 | |
|
244 | |
|
245 | |
|
246 | |
|
247 | |
|
248 | |
|
249 | |
|
250 | |
|
251 | |
|
252 | |
|
253 | |
|
254 | |
|
255 | |
private List additionalBuildcommands; |
256 | |
|
257 | |
|
258 | |
|
259 | |
|
260 | |
|
261 | |
|
262 | |
|
263 | |
|
264 | |
|
265 | |
|
266 | |
|
267 | |
|
268 | |
|
269 | |
|
270 | |
|
271 | |
private List classpathContainers; |
272 | |
|
273 | |
|
274 | |
|
275 | |
|
276 | |
|
277 | |
|
278 | |
|
279 | |
private boolean eclipseDownloadSources; |
280 | |
|
281 | |
|
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
private File eclipseProjectDir; |
287 | |
|
288 | |
|
289 | |
|
290 | |
|
291 | |
|
292 | |
|
293 | |
|
294 | |
|
295 | |
private boolean useProjectReferences; |
296 | |
|
297 | |
|
298 | |
|
299 | |
|
300 | |
|
301 | |
|
302 | |
|
303 | |
|
304 | |
private File buildOutputDirectory; |
305 | |
|
306 | |
|
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
private String wtpversion; |
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
|
319 | |
private String wtpContextName; |
320 | |
|
321 | |
|
322 | |
|
323 | |
|
324 | |
|
325 | |
|
326 | |
|
327 | |
|
328 | |
|
329 | |
private boolean pde; |
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
private boolean ajdt; |
335 | |
|
336 | |
|
337 | |
|
338 | |
|
339 | |
|
340 | |
|
341 | |
private File manifest; |
342 | |
|
343 | |
|
344 | |
|
345 | |
|
346 | |
|
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
|
357 | |
|
358 | |
|
359 | |
|
360 | |
|
361 | |
|
362 | |
|
363 | |
|
364 | |
|
365 | |
|
366 | |
|
367 | |
|
368 | |
|
369 | |
|
370 | |
|
371 | |
|
372 | |
|
373 | |
|
374 | |
|
375 | |
|
376 | |
|
377 | |
|
378 | |
|
379 | |
|
380 | |
|
381 | |
|
382 | |
|
383 | |
|
384 | |
|
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
|
399 | |
|
400 | |
|
401 | |
|
402 | |
|
403 | |
|
404 | |
|
405 | |
|
406 | |
|
407 | |
|
408 | |
|
409 | |
|
410 | |
|
411 | |
|
412 | |
private EclipseConfigFile[] additionalConfig; |
413 | |
|
414 | |
|
415 | |
|
416 | |
|
417 | |
|
418 | |
|
419 | |
|
420 | |
private boolean addVersionToProjectName; |
421 | |
|
422 | |
|
423 | |
|
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
private boolean addGroupIdToProjectName; |
429 | |
|
430 | |
|
431 | |
|
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
private String projectNameTemplate; |
438 | |
|
439 | |
|
440 | |
|
441 | |
|
442 | |
private float wtpVersionFloat; |
443 | |
|
444 | |
|
445 | |
|
446 | |
|
447 | |
private boolean isJavaProject; |
448 | |
|
449 | |
|
450 | |
|
451 | |
|
452 | |
|
453 | |
|
454 | |
private boolean wtpmanifest; |
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
|
461 | |
private boolean wtpapplicationxml; |
462 | |
|
463 | |
|
464 | |
|
465 | |
|
466 | |
|
467 | |
|
468 | |
private String wtpdefaultserver; |
469 | |
|
470 | |
private WorkspaceConfiguration workspaceConfiguration; |
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
|
477 | |
|
478 | |
|
479 | |
private ResourceManager locator; |
480 | |
|
481 | |
|
482 | |
|
483 | |
|
484 | |
|
485 | |
|
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
protected File workspace; |
493 | |
|
494 | |
|
495 | |
|
496 | |
|
497 | |
|
498 | |
|
499 | |
|
500 | |
protected boolean limitProjectReferencesToWorkspace; |
501 | |
|
502 | |
|
503 | |
|
504 | |
|
505 | |
|
506 | |
|
507 | |
|
508 | |
private String ajdtVersion; |
509 | |
|
510 | |
protected final boolean isJavaProject() |
511 | |
{ |
512 | 0 | return isJavaProject; |
513 | |
} |
514 | |
|
515 | |
protected final boolean isPdeProject() |
516 | |
{ |
517 | 0 | return pde; |
518 | |
} |
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
|
525 | |
public final List getBuildcommands() |
526 | |
{ |
527 | 0 | return buildcommands; |
528 | |
} |
529 | |
|
530 | |
|
531 | |
|
532 | |
|
533 | |
|
534 | |
|
535 | |
public final void setBuildcommands( List buildcommands ) |
536 | |
{ |
537 | 0 | this.buildcommands = buildcommands; |
538 | 0 | } |
539 | |
|
540 | |
|
541 | |
|
542 | |
|
543 | |
|
544 | |
|
545 | |
public final File getBuildOutputDirectory() |
546 | |
{ |
547 | 0 | return buildOutputDirectory; |
548 | |
} |
549 | |
|
550 | |
|
551 | |
|
552 | |
|
553 | |
|
554 | |
|
555 | |
public final void setBuildOutputDirectory( File buildOutputDirectory ) |
556 | |
{ |
557 | 0 | this.buildOutputDirectory = buildOutputDirectory; |
558 | 0 | } |
559 | |
|
560 | |
|
561 | |
|
562 | |
|
563 | |
|
564 | |
|
565 | |
public final List getClasspathContainers() |
566 | |
{ |
567 | 0 | return classpathContainers; |
568 | |
} |
569 | |
|
570 | |
|
571 | |
|
572 | |
|
573 | |
|
574 | |
|
575 | |
public final void setClasspathContainers( List classpathContainers ) |
576 | |
{ |
577 | 0 | this.classpathContainers = classpathContainers; |
578 | 0 | } |
579 | |
|
580 | |
|
581 | |
|
582 | |
|
583 | |
|
584 | |
|
585 | |
public final File getEclipseProjectDir() |
586 | |
{ |
587 | 0 | return eclipseProjectDir; |
588 | |
} |
589 | |
|
590 | |
|
591 | |
|
592 | |
|
593 | |
|
594 | |
|
595 | |
public final void setEclipseProjectDir( File eclipseProjectDir ) |
596 | |
{ |
597 | 0 | this.eclipseProjectDir = eclipseProjectDir; |
598 | 0 | } |
599 | |
|
600 | |
|
601 | |
|
602 | |
|
603 | |
|
604 | |
|
605 | |
public final List getProjectnatures() |
606 | |
{ |
607 | 0 | return projectnatures; |
608 | |
} |
609 | |
|
610 | |
|
611 | |
|
612 | |
|
613 | |
|
614 | |
|
615 | |
public final void setProjectnatures( List projectnatures ) |
616 | |
{ |
617 | 0 | this.projectnatures = projectnatures; |
618 | 0 | } |
619 | |
|
620 | |
|
621 | |
|
622 | |
|
623 | |
|
624 | |
|
625 | |
public final boolean getUseProjectReferences() |
626 | |
{ |
627 | 0 | return useProjectReferences; |
628 | |
} |
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
public final void setUseProjectReferences( boolean useProjectReferences ) |
636 | |
{ |
637 | 0 | this.useProjectReferences = useProjectReferences; |
638 | 0 | } |
639 | |
|
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
public final String getWtpversion() |
646 | |
{ |
647 | 0 | return wtpversion; |
648 | |
} |
649 | |
|
650 | |
|
651 | |
|
652 | |
|
653 | |
|
654 | |
|
655 | |
public final void setWtpversion( String wtpversion ) |
656 | |
{ |
657 | 0 | this.wtpversion = wtpversion; |
658 | 0 | } |
659 | |
|
660 | |
|
661 | |
|
662 | |
|
663 | |
|
664 | |
|
665 | |
public final List getAdditionalBuildcommands() |
666 | |
{ |
667 | 0 | return additionalBuildcommands; |
668 | |
} |
669 | |
|
670 | |
|
671 | |
|
672 | |
|
673 | |
|
674 | |
|
675 | |
public final void setAdditionalBuildcommands( List additionalBuildcommands ) |
676 | |
{ |
677 | 0 | this.additionalBuildcommands = additionalBuildcommands; |
678 | 0 | } |
679 | |
|
680 | |
|
681 | |
|
682 | |
|
683 | |
|
684 | |
|
685 | |
public final List getAdditionalProjectnatures() |
686 | |
{ |
687 | 0 | return additionalProjectnatures; |
688 | |
} |
689 | |
|
690 | |
|
691 | |
|
692 | |
|
693 | |
|
694 | |
|
695 | |
public final void setAdditionalProjectnatures( List additionalProjectnatures ) |
696 | |
{ |
697 | 0 | this.additionalProjectnatures = additionalProjectnatures; |
698 | 0 | } |
699 | |
|
700 | |
|
701 | |
|
702 | |
|
703 | |
public final boolean isAddVersionToProjectName() |
704 | |
{ |
705 | 0 | return addVersionToProjectName; |
706 | |
} |
707 | |
|
708 | |
|
709 | |
|
710 | |
|
711 | |
public final void setAddVersionToProjectName( boolean addVersionToProjectName ) |
712 | |
{ |
713 | 0 | this.addVersionToProjectName = addVersionToProjectName; |
714 | 0 | } |
715 | |
|
716 | |
|
717 | |
|
718 | |
|
719 | |
public final boolean isAddGroupIdToProjectName() |
720 | |
{ |
721 | 0 | return addGroupIdToProjectName; |
722 | |
} |
723 | |
|
724 | |
|
725 | |
|
726 | |
|
727 | |
public final void setAddGroupIdToProjectName( boolean addGroupIdToProjectName ) |
728 | |
{ |
729 | 0 | this.addGroupIdToProjectName = addGroupIdToProjectName; |
730 | 0 | } |
731 | |
|
732 | |
|
733 | |
|
734 | |
|
735 | |
|
736 | |
|
737 | |
public final String getProjectNameTemplate() |
738 | |
{ |
739 | 0 | return projectNameTemplate; |
740 | |
} |
741 | |
|
742 | |
|
743 | |
|
744 | |
|
745 | |
|
746 | |
|
747 | |
public final void setProjectNameTemplate( String projectNameTemplate ) |
748 | |
{ |
749 | 0 | this.projectNameTemplate = projectNameTemplate; |
750 | 0 | } |
751 | |
|
752 | |
|
753 | |
|
754 | |
|
755 | |
public final boolean setup() |
756 | |
throws MojoExecutionException |
757 | |
{ |
758 | 0 | boolean ready = true; |
759 | |
|
760 | 0 | checkDeprecations(); |
761 | 0 | setProjectNameTemplate( IdeUtils.calculateProjectNameTemplate( getProjectNameTemplate(), isAddVersionToProjectName(), |
762 | |
isAddGroupIdToProjectName(), getLog() ) ); |
763 | 0 | ajdt = enableAjdt( executedProject ) && !ajdtVersion.equals( "none" ); |
764 | 0 | ready = validate(); |
765 | |
|
766 | |
|
767 | 0 | ArtifactHandler artifactHandler = project.getArtifact().getArtifactHandler(); |
768 | |
|
769 | |
|
770 | |
|
771 | 0 | isJavaProject = |
772 | |
pde |
773 | |
|| ( Constants.LANGUAGE_JAVA.equals( artifactHandler.getLanguage() ) && !Constants.PROJECT_PACKAGING_EAR.equals( packaging ) ); |
774 | |
|
775 | 0 | setupExtras(); |
776 | |
|
777 | 0 | parseConfigurationOptions(); |
778 | |
|
779 | |
|
780 | 0 | if ( projectnatures == null ) |
781 | |
{ |
782 | 0 | fillDefaultNatures( packaging ); |
783 | |
} |
784 | |
|
785 | 0 | if ( additionalProjectnatures != null ) |
786 | |
{ |
787 | 0 | projectnatures.addAll( additionalProjectnatures ); |
788 | |
} |
789 | |
|
790 | 0 | if ( buildcommands == null ) |
791 | |
{ |
792 | 0 | fillDefaultBuilders( packaging ); |
793 | |
} |
794 | |
else |
795 | |
{ |
796 | 0 | convertBuildCommandList( buildcommands ); |
797 | |
} |
798 | |
|
799 | 0 | if ( additionalBuildcommands != null ) |
800 | |
{ |
801 | 0 | convertBuildCommandList( additionalBuildcommands ); |
802 | 0 | buildcommands.addAll( additionalBuildcommands ); |
803 | |
} |
804 | |
|
805 | 0 | if ( classpathContainers == null ) |
806 | |
{ |
807 | 0 | fillDefaultClasspathContainers( packaging ); |
808 | |
} |
809 | |
else |
810 | |
{ |
811 | 0 | verifyClasspathContainerListIsComplete(); |
812 | |
} |
813 | 0 | locator.addSearchPath( FileResourceLoader.ID, project.getFile().getParentFile().getAbsolutePath() ); |
814 | 0 | locator.setOutputDirectory( new File( project.getBuild().getDirectory() ) ); |
815 | |
|
816 | |
|
817 | 0 | return ready; |
818 | |
} |
819 | |
|
820 | |
|
821 | |
|
822 | |
|
823 | |
|
824 | |
|
825 | |
|
826 | |
protected final void convertBuildCommandList( List commands ) |
827 | |
{ |
828 | 0 | if ( commands != null ) |
829 | |
{ |
830 | 0 | for ( ListIterator i = commands.listIterator(); i.hasNext(); ) |
831 | |
{ |
832 | 0 | Object command = i.next(); |
833 | |
|
834 | 0 | if ( command instanceof String ) |
835 | |
{ |
836 | 0 | command = new BuildCommand( (String) command ); |
837 | 0 | i.set( command ); |
838 | |
} |
839 | |
} |
840 | |
} |
841 | 0 | } |
842 | |
|
843 | |
private void parseConfigurationOptions() |
844 | |
{ |
845 | 0 | if ( "R7".equalsIgnoreCase( wtpversion ) ) |
846 | |
{ |
847 | 0 | wtpVersionFloat = 0.7f; |
848 | |
} |
849 | 0 | else if ( "1.0".equalsIgnoreCase( wtpversion ) ) |
850 | |
{ |
851 | 0 | wtpVersionFloat = 1.0f; |
852 | |
} |
853 | 0 | else if ( "1.5".equalsIgnoreCase( wtpversion ) ) |
854 | |
{ |
855 | 0 | wtpVersionFloat = 1.5f; |
856 | |
} |
857 | 0 | else if ( "2.0".equalsIgnoreCase( wtpversion ) ) |
858 | |
{ |
859 | 0 | wtpVersionFloat = 2.0f; |
860 | |
} |
861 | 0 | if ( !"none".equalsIgnoreCase( wtpversion ) ) |
862 | |
{ |
863 | 0 | getLog().info( Messages.getString( "EclipsePlugin.wtpversion", wtpversion ) ); |
864 | |
} |
865 | 0 | } |
866 | |
|
867 | |
|
868 | |
|
869 | |
|
870 | |
|
871 | |
|
872 | |
|
873 | |
|
874 | |
protected void setupExtras() |
875 | |
throws MojoExecutionException |
876 | |
{ |
877 | |
|
878 | 0 | } |
879 | |
|
880 | |
private void verifyClasspathContainerListIsComplete() |
881 | |
{ |
882 | 0 | boolean containsJREContainer = false; |
883 | |
|
884 | |
|
885 | 0 | for ( Iterator iter = classpathContainers.iterator(); iter.hasNext(); ) |
886 | |
{ |
887 | 0 | Object classPathContainer = iter.next(); |
888 | 0 | if ( classPathContainer != null |
889 | |
&& classPathContainer.toString().startsWith( COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER ) ) |
890 | |
{ |
891 | 0 | containsJREContainer = true; |
892 | 0 | break; |
893 | |
} |
894 | |
} |
895 | 0 | if ( !containsJREContainer ) |
896 | |
{ |
897 | 0 | getLog().warn( Messages.getString( "EclipsePlugin.missingjrecontainer" ) ); |
898 | 0 | classpathContainers.add( 0, COMMON_PATH_JDT_LAUNCHING_JRE_CONTAINER ); |
899 | |
} |
900 | 0 | } |
901 | |
|
902 | |
private boolean validate() |
903 | |
throws MojoExecutionException |
904 | |
{ |
905 | |
|
906 | 0 | if ( Arrays.binarySearch( WTP_SUPPORTED_VERSIONS, wtpversion ) < 0 ) |
907 | |
{ |
908 | 0 | throw new MojoExecutionException( |
909 | |
Messages.getString( "EclipsePlugin.unsupportedwtp", new Object[] { |
910 | |
wtpversion, |
911 | |
StringUtils.join( WTP_SUPPORTED_VERSIONS, " " ) } ) ); |
912 | |
} |
913 | |
|
914 | 0 | assertNotEmpty( executedProject.getGroupId(), POM_ELT_GROUP_ID ); |
915 | 0 | assertNotEmpty( executedProject.getArtifactId(), POM_ELT_ARTIFACT_ID ); |
916 | |
|
917 | 0 | if ( executedProject.getFile() == null || !executedProject.getFile().exists() ) |
918 | |
{ |
919 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.missingpom" ) ); |
920 | |
} |
921 | |
|
922 | 0 | if ( "pom".equals( packaging ) && eclipseProjectDir == null ) |
923 | |
{ |
924 | 0 | getLog().info( Messages.getString( "EclipsePlugin.pompackaging" ) ); |
925 | 0 | return false; |
926 | |
} |
927 | |
|
928 | 0 | if ( "eclipse-plugin".equals( packaging ) ) |
929 | |
{ |
930 | 0 | pde = true; |
931 | |
} |
932 | |
|
933 | 0 | if ( eclipseProjectDir == null ) |
934 | |
{ |
935 | 0 | eclipseProjectDir = executedProject.getFile().getParentFile(); |
936 | |
} |
937 | |
|
938 | 0 | if ( !eclipseProjectDir.exists() && !eclipseProjectDir.mkdirs() ) |
939 | |
{ |
940 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcreatedir", eclipseProjectDir ) ); |
941 | |
} |
942 | |
|
943 | 0 | if ( !eclipseProjectDir.equals( executedProject.getFile().getParentFile() ) ) |
944 | |
{ |
945 | 0 | if ( !eclipseProjectDir.isDirectory() ) |
946 | |
{ |
947 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.notadir", eclipseProjectDir ) ); |
948 | |
} |
949 | 0 | eclipseProjectDir = new File( eclipseProjectDir, executedProject.getArtifactId() ); |
950 | 0 | if ( !eclipseProjectDir.isDirectory() && !eclipseProjectDir.mkdirs() ) |
951 | |
{ |
952 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcreatedir", eclipseProjectDir ) ); |
953 | |
} |
954 | |
} |
955 | |
|
956 | 0 | validateExtras(); |
957 | |
|
958 | 0 | return true; |
959 | |
} |
960 | |
|
961 | |
|
962 | |
|
963 | |
|
964 | |
|
965 | |
|
966 | |
|
967 | |
|
968 | |
protected void validateExtras() throws MojoExecutionException |
969 | |
{ |
970 | |
|
971 | 0 | } |
972 | |
|
973 | |
private void checkDeprecations() |
974 | |
{ |
975 | 0 | if ( eclipseDownloadSources ) |
976 | |
{ |
977 | |
|
978 | 0 | getLog().warn( Messages.getString( "EclipsePlugin.deprecatedpar", new Object[] { |
979 | |
"eclipse.downloadSources", |
980 | |
"downloadSources" } ) ); |
981 | 0 | downloadSources = true; |
982 | |
} |
983 | |
|
984 | 0 | checkDeprecationsExtras(); |
985 | 0 | } |
986 | |
|
987 | |
|
988 | |
|
989 | |
|
990 | |
|
991 | |
|
992 | |
protected void checkDeprecationsExtras() |
993 | |
{ |
994 | |
|
995 | 0 | } |
996 | |
|
997 | |
public final void writeConfiguration( IdeDependency[] deps ) |
998 | |
throws MojoExecutionException |
999 | |
{ |
1000 | 0 | EclipseWriterConfig config = createEclipseWriterConfig( deps ); |
1001 | |
|
1002 | 0 | if ( wtpmanifest && isJavaProject() ) |
1003 | |
{ |
1004 | 0 | EclipseManifestWriter.addManifestResource( getLog(), config ); |
1005 | |
} |
1006 | |
|
1007 | 0 | writeConfigurationExtras( config ); |
1008 | |
|
1009 | 0 | if ( wtpVersionFloat == 0.7f ) |
1010 | |
{ |
1011 | 0 | new EclipseWtpmodulesWriter().init( getLog(), config ).write(); |
1012 | |
} |
1013 | |
|
1014 | 0 | if ( wtpVersionFloat >= 1.0f ) |
1015 | |
{ |
1016 | 0 | new EclipseWtpFacetsWriter().init( getLog(), config ).write(); |
1017 | |
} |
1018 | 0 | if ( wtpVersionFloat == 1.0f ) |
1019 | |
{ |
1020 | 0 | new EclipseWtpComponentWriter().init( getLog(), config ).write(); |
1021 | |
} |
1022 | 0 | if ( wtpVersionFloat >= 1.5 ) |
1023 | |
{ |
1024 | 0 | new EclipseWtpComponent15Writer().init( getLog(), config ).write(); |
1025 | |
} |
1026 | |
|
1027 | 0 | new EclipseSettingsWriter().init( getLog(), config ).write(); |
1028 | |
|
1029 | 0 | if ( isJavaProject ) |
1030 | |
{ |
1031 | 0 | new EclipseClasspathWriter().init( getLog(), config ).write(); |
1032 | 0 | if ( ajdt && ajdtVersion.equals( "1.4" ) ) |
1033 | |
{ |
1034 | 0 | new EclipseAjdtWriter().init( getLog(), config ).write(); |
1035 | |
} |
1036 | |
} |
1037 | |
|
1038 | 0 | if ( wtpapplicationxml ) |
1039 | |
{ |
1040 | 0 | new EclipseWtpApplicationXMLWriter().init( getLog(), config ).write(); |
1041 | |
} |
1042 | |
|
1043 | 0 | if ( pde ) |
1044 | |
{ |
1045 | 0 | this.getLog().info( "The Maven Eclipse plugin runs in 'pde'-mode." ); |
1046 | 0 | new EclipseOSGiManifestWriter().init( getLog(), config ).write(); |
1047 | |
} |
1048 | |
|
1049 | |
|
1050 | |
|
1051 | |
|
1052 | |
|
1053 | 0 | new EclipseProjectWriter().init( getLog(), config ).write(); |
1054 | |
|
1055 | 0 | writeAdditionalConfig(); |
1056 | |
|
1057 | 0 | getLog().info( Messages.getString( "EclipsePlugin.wrote", new Object[] { |
1058 | |
config.getEclipseProjectName(), eclipseProjectDir.getAbsolutePath() } ) ); |
1059 | 0 | } |
1060 | |
|
1061 | |
private void writeAdditionalConfig() |
1062 | |
throws MojoExecutionException |
1063 | |
{ |
1064 | 0 | if ( additionalConfig != null ) |
1065 | |
{ |
1066 | 0 | for ( int j = 0; j < additionalConfig.length; j++ ) |
1067 | |
{ |
1068 | 0 | EclipseConfigFile file = additionalConfig[j]; |
1069 | 0 | File projectRelativeFile = new File( eclipseProjectDir, file.getName() ); |
1070 | 0 | if ( projectRelativeFile.isDirectory() ) |
1071 | |
{ |
1072 | |
|
1073 | 0 | getLog().warn( Messages.getString( "EclipsePlugin.foundadir", |
1074 | |
projectRelativeFile.getAbsolutePath() ) ); |
1075 | |
} |
1076 | |
|
1077 | |
try |
1078 | |
{ |
1079 | 0 | projectRelativeFile.getParentFile().mkdirs(); |
1080 | 0 | if ( file.getContent() == null ) |
1081 | |
{ |
1082 | |
InputStream inStream; |
1083 | 0 | if ( file.getLocation() != null ) |
1084 | |
{ |
1085 | 0 | inStream = locator.getResourceAsInputStream( file.getLocation() ); |
1086 | |
} |
1087 | |
else |
1088 | |
{ |
1089 | 0 | inStream = file.getURL().openConnection().getInputStream(); |
1090 | |
} |
1091 | 0 | OutputStream outStream = new FileOutputStream( projectRelativeFile ); |
1092 | |
try |
1093 | |
{ |
1094 | 0 | IOUtil.copy( inStream, outStream ); |
1095 | |
} |
1096 | |
finally |
1097 | |
{ |
1098 | 0 | inStream.close(); |
1099 | 0 | outStream.close(); |
1100 | 0 | } |
1101 | |
} |
1102 | |
else |
1103 | |
{ |
1104 | 0 | FileUtils.fileWrite( projectRelativeFile.getAbsolutePath(), file.getContent() ); |
1105 | |
} |
1106 | |
} |
1107 | 0 | catch ( IOException e ) |
1108 | |
{ |
1109 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantwritetofile", |
1110 | |
projectRelativeFile.getAbsolutePath() ) ); |
1111 | |
} |
1112 | 0 | catch ( ResourceNotFoundException e ) |
1113 | |
{ |
1114 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantfindresource", |
1115 | |
file.getLocation() ) ); |
1116 | 0 | } |
1117 | |
|
1118 | |
} |
1119 | |
} |
1120 | 0 | } |
1121 | |
|
1122 | |
|
1123 | |
|
1124 | |
|
1125 | |
|
1126 | |
|
1127 | |
|
1128 | |
|
1129 | |
protected final EclipseWriterConfig createEclipseWriterConfig( IdeDependency[] deps ) |
1130 | |
throws MojoExecutionException |
1131 | |
{ |
1132 | 0 | File projectBaseDir = executedProject.getFile().getParentFile(); |
1133 | |
|
1134 | |
|
1135 | |
|
1136 | 0 | EclipseSourceDir[] sourceDirs = buildDirectoryList( executedProject, eclipseProjectDir, buildOutputDirectory ); |
1137 | |
|
1138 | 0 | EclipseWriterConfig config = new EclipseWriterConfig(); |
1139 | |
|
1140 | 0 | config.setWorkspaceConfiguration( getWorkspaceConfiguration() ); |
1141 | |
|
1142 | 0 | config.setProjectNameTemplate( getProjectNameTemplate() ); |
1143 | |
|
1144 | 0 | String projectName = IdeUtils.getProjectName( config.getProjectNameTemplate(), project ); |
1145 | |
|
1146 | 0 | config.setEclipseProjectName( projectName ); |
1147 | |
|
1148 | 0 | config.setWtpapplicationxml( wtpapplicationxml ); |
1149 | |
|
1150 | 0 | config.setWtpVersion( wtpVersionFloat ); |
1151 | |
|
1152 | |
float ajdtVersionFloat; |
1153 | |
try |
1154 | |
{ |
1155 | 0 | ajdtVersionFloat = Float.parseFloat( ajdtVersion ); |
1156 | |
} |
1157 | 0 | catch ( NumberFormatException e ) |
1158 | |
{ |
1159 | 0 | ajdtVersionFloat = 0.0f; |
1160 | 0 | } |
1161 | |
|
1162 | 0 | config.setAjdtVersion( ajdtVersionFloat ); |
1163 | |
|
1164 | 0 | Set convertedBuildCommands = new LinkedHashSet(); |
1165 | |
|
1166 | 0 | if ( buildcommands != null ) |
1167 | |
{ |
1168 | 0 | for ( Iterator it = buildcommands.iterator(); it.hasNext(); ) |
1169 | |
{ |
1170 | 0 | Object cmd = it.next(); |
1171 | |
|
1172 | 0 | if ( cmd instanceof BuildCommand ) |
1173 | |
{ |
1174 | 0 | convertedBuildCommands.add( cmd ); |
1175 | |
} |
1176 | |
else |
1177 | |
{ |
1178 | 0 | convertedBuildCommands.add( new BuildCommand( (String) cmd ) ); |
1179 | |
} |
1180 | |
} |
1181 | |
} |
1182 | |
|
1183 | 0 | if ( ajdt ) |
1184 | |
{ |
1185 | 0 | buildAjdtWeaveDeps( deps ); |
1186 | 0 | buildAspectjDeps( deps ); |
1187 | |
} |
1188 | |
|
1189 | 0 | config.setBuildCommands( new LinkedList( convertedBuildCommands ) ); |
1190 | |
|
1191 | 0 | config.setBuildOutputDirectory( buildOutputDirectory ); |
1192 | 0 | config.setClasspathContainers( classpathContainers ); |
1193 | 0 | config.setDeps( deps ); |
1194 | 0 | config.setEclipseProjectDirectory( eclipseProjectDir ); |
1195 | 0 | config.setLocalRepository( localRepository ); |
1196 | 0 | config.setOSGIManifestFile( manifest ); |
1197 | 0 | config.setPde( pde ); |
1198 | 0 | config.setProject( project ); |
1199 | 0 | config.setProjectBaseDir( projectBaseDir ); |
1200 | 0 | config.setProjectnatures( projectnatures ); |
1201 | 0 | config.setProjectFacets( additionalProjectFacets ); |
1202 | 0 | config.setSourceDirs( sourceDirs ); |
1203 | 0 | config.setAddVersionToProjectName( isAddVersionToProjectName() ); |
1204 | 0 | config.setPackaging( packaging ); |
1205 | |
|
1206 | 0 | collectWarContextRootsFromReactorEarConfiguration( config ); |
1207 | |
|
1208 | 0 | return config; |
1209 | |
} |
1210 | |
|
1211 | |
|
1212 | |
|
1213 | |
|
1214 | |
|
1215 | |
|
1216 | |
|
1217 | |
private void collectWarContextRootsFromReactorEarConfiguration( EclipseWriterConfig config ) |
1218 | |
{ |
1219 | 0 | if ( reactorProjects != null && wtpContextName == null |
1220 | |
&& Constants.PROJECT_PACKAGING_WAR.equals( project.getPackaging() ) ) |
1221 | |
{ |
1222 | 0 | for ( Iterator iter = reactorProjects.iterator(); iter.hasNext(); ) |
1223 | |
{ |
1224 | 0 | MavenProject reactorProject = (MavenProject) iter.next(); |
1225 | |
|
1226 | 0 | if ( Constants.PROJECT_PACKAGING_EAR.equals( reactorProject.getPackaging() ) ) |
1227 | |
{ |
1228 | 0 | Xpp3Dom[] warDefinitions = |
1229 | |
IdeUtils.getPluginConfigurationDom( reactorProject, JeeUtils.ARTIFACT_MAVEN_EAR_PLUGIN, |
1230 | |
new String[] { "modules", "webModule" } ); |
1231 | 0 | for ( int index = 0; index < warDefinitions.length; index++ ) |
1232 | |
{ |
1233 | 0 | Xpp3Dom groupId = warDefinitions[index].getChild( "groupId" ); |
1234 | 0 | Xpp3Dom artifactId = warDefinitions[index].getChild( "artifactId" ); |
1235 | 0 | Xpp3Dom contextRoot = warDefinitions[index].getChild( "contextRoot" ); |
1236 | 0 | if ( groupId != null && artifactId != null && contextRoot != null && groupId.getValue() != null |
1237 | |
&& artifactId.getValue() != null && contextRoot.getValue() != null ) |
1238 | |
{ |
1239 | 0 | getLog().info( |
1240 | |
"Found context root definition for " + groupId.getValue() + ":" |
1241 | |
+ artifactId.getValue() + " " + contextRoot.getValue() ); |
1242 | 0 | if ( project.getArtifactId().equals( artifactId.getValue() ) |
1243 | |
&& project.getGroupId().equals( groupId.getValue() ) ) |
1244 | |
{ |
1245 | 0 | config.setContextName( contextRoot.getValue() ); |
1246 | |
} |
1247 | |
} |
1248 | |
else |
1249 | |
{ |
1250 | 0 | getLog().info( |
1251 | |
"Found incomplete ear configuration in " + reactorProject.getGroupId() + ":" |
1252 | |
+ reactorProject.getGroupId() + " found " |
1253 | |
+ warDefinitions[index].toString() ); |
1254 | |
} |
1255 | |
} |
1256 | |
} |
1257 | |
} |
1258 | |
} |
1259 | 0 | if ( config.getContextName() == null && Constants.PROJECT_PACKAGING_WAR.equals( project.getPackaging() ) ) |
1260 | |
{ |
1261 | 0 | if ( wtpContextName == null ) |
1262 | |
{ |
1263 | 0 | config.setContextName( project.getArtifactId() ); |
1264 | |
} |
1265 | |
else |
1266 | |
{ |
1267 | 0 | config.setContextName( wtpContextName ); |
1268 | |
} |
1269 | |
} |
1270 | 0 | } |
1271 | |
|
1272 | |
|
1273 | |
|
1274 | |
|
1275 | |
|
1276 | |
|
1277 | |
|
1278 | |
|
1279 | |
protected void writeConfigurationExtras( EclipseWriterConfig config ) |
1280 | |
throws MojoExecutionException |
1281 | |
{ |
1282 | |
|
1283 | 0 | } |
1284 | |
|
1285 | |
private void assertNotEmpty( String string, String elementName ) |
1286 | |
throws MojoExecutionException |
1287 | |
{ |
1288 | 0 | if ( string == null ) |
1289 | |
{ |
1290 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.missingelement", elementName ) ); |
1291 | |
} |
1292 | 0 | } |
1293 | |
|
1294 | |
|
1295 | |
|
1296 | |
|
1297 | |
|
1298 | |
|
1299 | |
|
1300 | |
|
1301 | |
|
1302 | |
protected void fillDefaultNatures( String packaging ) |
1303 | |
{ |
1304 | 0 | projectnatures = new ArrayList(); |
1305 | |
|
1306 | 0 | if ( wtpVersionFloat >= 1.0f ) |
1307 | |
{ |
1308 | 0 | projectnatures.add( NATURE_WST_FACET_CORE_NATURE ); |
1309 | |
} |
1310 | |
|
1311 | 0 | if ( isJavaProject ) |
1312 | |
{ |
1313 | 0 | if ( ajdt ) |
1314 | |
{ |
1315 | 0 | projectnatures.add( NATURE_AJDT_CORE_JAVA ); |
1316 | |
} |
1317 | |
|
1318 | 0 | projectnatures.add( NATURE_JDT_CORE_JAVA ); |
1319 | |
} |
1320 | |
|
1321 | 0 | if ( wtpVersionFloat >= 0.7f ) |
1322 | |
{ |
1323 | 0 | projectnatures.add( NATURE_WST_MODULE_CORE_NATURE ); |
1324 | |
|
1325 | 0 | if ( isJavaProject ) |
1326 | |
{ |
1327 | 0 | projectnatures.add( NATURE_JEM_WORKBENCH_JAVA_EMF ); |
1328 | |
} |
1329 | |
} |
1330 | |
|
1331 | 0 | if ( pde ) |
1332 | |
{ |
1333 | 0 | projectnatures.add( NATURE_PDE_PLUGIN ); |
1334 | |
} |
1335 | |
|
1336 | 0 | } |
1337 | |
|
1338 | |
|
1339 | |
|
1340 | |
|
1341 | |
|
1342 | |
|
1343 | |
|
1344 | |
|
1345 | |
|
1346 | |
protected void fillDefaultClasspathContainers( String packaging ) |
1347 | |
{ |
1348 | 0 | classpathContainers = new ArrayList(); |
1349 | |
|
1350 | 0 | if ( getWorkspaceConfiguration().getDefaultClasspathContainer() != null ) |
1351 | |
{ |
1352 | 0 | getLog().info( |
1353 | |
"Adding default classpath container: " |
1354 | |
+ getWorkspaceConfiguration().getDefaultClasspathContainer() ); |
1355 | 0 | classpathContainers.add( getWorkspaceConfiguration().getDefaultClasspathContainer() ); |
1356 | |
} |
1357 | 0 | if ( pde ) |
1358 | |
{ |
1359 | 0 | classpathContainers.add( REQUIRED_PLUGINS_CONTAINER ); |
1360 | |
} |
1361 | |
|
1362 | 0 | if ( ajdt ) |
1363 | |
{ |
1364 | 0 | classpathContainers.add( ASPECTJ_RT_CONTAINER ); |
1365 | |
} |
1366 | 0 | } |
1367 | |
|
1368 | |
|
1369 | |
|
1370 | |
|
1371 | |
|
1372 | |
|
1373 | |
|
1374 | |
|
1375 | |
|
1376 | |
protected void fillDefaultBuilders( String packaging ) |
1377 | |
{ |
1378 | 0 | buildcommands = new ArrayList(); |
1379 | |
|
1380 | 0 | if ( wtpVersionFloat == 0.7f ) |
1381 | |
{ |
1382 | 0 | buildcommands.add( new BuildCommand( BUILDER_WST_COMPONENT_STRUCTURAL ) ); |
1383 | |
} |
1384 | |
|
1385 | 0 | if ( isJavaProject ) |
1386 | |
{ |
1387 | 0 | if ( ajdt ) |
1388 | |
{ |
1389 | 0 | buildcommands.add( new BuildCommand( BUILDER_AJDT_CORE_JAVA ) ); |
1390 | |
} |
1391 | |
else |
1392 | |
{ |
1393 | 0 | buildcommands.add( new BuildCommand( BUILDER_JDT_CORE_JAVA ) ); |
1394 | |
} |
1395 | |
} |
1396 | |
|
1397 | 0 | if ( wtpVersionFloat >= 1.5f ) |
1398 | |
{ |
1399 | 0 | buildcommands.add( new BuildCommand( BUILDER_WST_FACET ) ); |
1400 | |
} |
1401 | |
|
1402 | 0 | if ( wtpVersionFloat >= 0.7f ) |
1403 | |
{ |
1404 | 0 | buildcommands.add( new BuildCommand( BUILDER_WST_VALIDATION ) ); |
1405 | |
} |
1406 | |
|
1407 | 0 | if ( wtpVersionFloat == 0.7f ) |
1408 | |
{ |
1409 | |
|
1410 | 0 | buildcommands.add( new BuildCommand( BUILDER_WST_COMPONENT_STRUCTURAL_DEPENDENCY_RESOLVER ) ); |
1411 | |
} |
1412 | |
|
1413 | 0 | if ( pde ) |
1414 | |
{ |
1415 | 0 | buildcommands.add( new BuildCommand( BUILDER_PDE_MANIFEST ) ); |
1416 | 0 | buildcommands.add( new BuildCommand( BUILDER_PDE_SCHEMA ) ); |
1417 | |
} |
1418 | 0 | } |
1419 | |
|
1420 | |
public final EclipseSourceDir[] buildDirectoryList( MavenProject project, File basedir, File buildOutputDirectory ) |
1421 | |
throws MojoExecutionException |
1422 | |
{ |
1423 | 4 | File projectBaseDir = project.getFile().getParentFile(); |
1424 | |
|
1425 | 4 | String mainOutput = IdeUtils.toRelativeAndFixSeparator( projectBaseDir, buildOutputDirectory, false ); |
1426 | |
|
1427 | |
|
1428 | 4 | String testOutput = null; |
1429 | 4 | boolean useStandardOutputDir = |
1430 | |
buildOutputDirectory.equals( new File( project.getBuild().getOutputDirectory() ) ); |
1431 | 4 | if ( useStandardOutputDir ) |
1432 | |
{ |
1433 | 4 | getLog().debug( |
1434 | |
"testOutput toRelativeAndFixSeparator " + projectBaseDir + " , " |
1435 | |
+ project.getBuild().getTestOutputDirectory() ); |
1436 | 4 | testOutput = |
1437 | |
IdeUtils.toRelativeAndFixSeparator( projectBaseDir, |
1438 | |
new File( project.getBuild().getTestOutputDirectory() ), false ); |
1439 | 4 | getLog().debug( "testOutput after toRelative : " + testOutput ); |
1440 | |
} |
1441 | |
|
1442 | 4 | Set mainDirectories = new LinkedHashSet(); |
1443 | |
|
1444 | 4 | extractSourceDirs( mainDirectories, project.getCompileSourceRoots(), basedir, projectBaseDir, false, null ); |
1445 | |
|
1446 | 4 | extractResourceDirs( mainDirectories, project.getBuild().getResources(), basedir, projectBaseDir, false, |
1447 | |
mainOutput ); |
1448 | |
|
1449 | 4 | Set testDirectories = new LinkedHashSet(); |
1450 | |
|
1451 | 4 | extractSourceDirs( testDirectories, project.getTestCompileSourceRoots(), basedir, projectBaseDir, true, |
1452 | |
testOutput ); |
1453 | |
|
1454 | 4 | extractResourceDirs( testDirectories, project.getBuild().getTestResources(), basedir, projectBaseDir, true, |
1455 | |
testOutput ); |
1456 | |
|
1457 | |
|
1458 | 4 | Set directories = new LinkedHashSet(); |
1459 | |
|
1460 | |
|
1461 | 4 | boolean testBeforeMain = isMavenVersion( "[2.0.8,)" ); |
1462 | |
|
1463 | 4 | if ( testBeforeMain ) |
1464 | |
{ |
1465 | 4 | directories.addAll( testDirectories ); |
1466 | 4 | directories.removeAll( mainDirectories ); |
1467 | 4 | directories.addAll( mainDirectories ); |
1468 | |
} |
1469 | |
else |
1470 | |
{ |
1471 | 0 | directories.addAll( mainDirectories ); |
1472 | 0 | directories.addAll( testDirectories ); |
1473 | |
} |
1474 | 4 | if ( ajdt ) |
1475 | 0 | extractAspectDirs( directories, project, basedir, projectBaseDir, testOutput ); |
1476 | 4 | return (EclipseSourceDir[]) directories.toArray( new EclipseSourceDir[directories.size()] ); |
1477 | |
} |
1478 | |
|
1479 | |
private void extractSourceDirs( Set directories, List sourceRoots, File basedir, File projectBaseDir, boolean test, |
1480 | |
String output ) |
1481 | |
throws MojoExecutionException |
1482 | |
{ |
1483 | 8 | for ( Iterator it = sourceRoots.iterator(); it.hasNext(); ) |
1484 | |
{ |
1485 | |
|
1486 | 0 | File sourceRootFile = new File( (String) it.next() ); |
1487 | |
|
1488 | 0 | if ( sourceRootFile.isDirectory() ) |
1489 | |
{ |
1490 | 0 | String sourceRoot = |
1491 | |
IdeUtils.toRelativeAndFixSeparator( projectBaseDir, sourceRootFile, |
1492 | |
!projectBaseDir.equals( basedir ) ); |
1493 | |
|
1494 | 0 | directories.add( new EclipseSourceDir( sourceRoot, output, false, test, null, null, false ) ); |
1495 | |
} |
1496 | |
} |
1497 | 8 | } |
1498 | |
|
1499 | |
final void extractResourceDirs( Set directories, List resources, File basedir, File workspaceProjectBaseDir, |
1500 | |
boolean test, final String output ) |
1501 | |
throws MojoExecutionException |
1502 | |
{ |
1503 | 32 | for ( Iterator it = resources.iterator(); it.hasNext(); ) |
1504 | |
{ |
1505 | 28 | Resource resource = (Resource) it.next(); |
1506 | |
|
1507 | 28 | getLog().debug( "Processing resource dir: " + resource.getDirectory() ); |
1508 | |
|
1509 | 28 | String includePattern = null; |
1510 | 28 | String excludePattern = null; |
1511 | |
|
1512 | 28 | if ( resource.getIncludes().size() != 0 ) |
1513 | |
{ |
1514 | 0 | includePattern = StringUtils.join( resource.getIncludes().iterator(), "|" ); |
1515 | |
} |
1516 | |
|
1517 | 28 | if ( resource.getExcludes().size() != 0 ) |
1518 | |
{ |
1519 | 0 | excludePattern = StringUtils.join( resource.getExcludes().iterator(), "|" ); |
1520 | |
} |
1521 | |
|
1522 | |
|
1523 | |
|
1524 | |
|
1525 | 28 | File resourceDirectory = new File( resource.getDirectory() ); |
1526 | |
|
1527 | 28 | if ( !resourceDirectory.exists() || !resourceDirectory.isDirectory() ) |
1528 | |
{ |
1529 | 0 | getLog().debug( "Resource dir: " + resourceDirectory + " either missing or not a directory." ); |
1530 | 0 | continue; |
1531 | |
} |
1532 | |
|
1533 | 28 | String resourceDir = |
1534 | |
IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, resourceDirectory, |
1535 | |
!workspaceProjectBaseDir.equals( basedir ) ); |
1536 | 28 | String thisOutput = output; |
1537 | 28 | if ( thisOutput != null ) |
1538 | |
{ |
1539 | |
|
1540 | 28 | File outputFile = new File( thisOutput ); |
1541 | 28 | if ( !outputFile.isAbsolute() ) |
1542 | |
{ |
1543 | 28 | outputFile = new File( workspaceProjectBaseDir, thisOutput ); |
1544 | |
} |
1545 | |
|
1546 | 28 | outputFile.mkdirs(); |
1547 | |
|
1548 | 28 | if ( !StringUtils.isEmpty( resource.getTargetPath() ) ) |
1549 | |
{ |
1550 | 4 | outputFile = new File( outputFile, resource.getTargetPath() ); |
1551 | |
|
1552 | 4 | outputFile.mkdirs(); |
1553 | |
} |
1554 | |
|
1555 | 28 | getLog().debug( |
1556 | |
"Making relative and fixing separator: { " + workspaceProjectBaseDir + ", " |
1557 | |
+ outputFile + ", false }." ); |
1558 | 28 | thisOutput = IdeUtils.toRelativeAndFixSeparator( workspaceProjectBaseDir, outputFile, false ); |
1559 | |
} |
1560 | |
|
1561 | 28 | getLog().debug( |
1562 | |
"Adding eclipse source dir: { " + resourceDir + ", " + thisOutput + ", true, " + test |
1563 | |
+ ", " + includePattern + ", " + excludePattern + " }." ); |
1564 | |
|
1565 | 28 | directories.add( new EclipseSourceDir( resourceDir, thisOutput, true, test, includePattern, excludePattern, |
1566 | |
resource.isFiltering() ) ); |
1567 | |
} |
1568 | 32 | } |
1569 | |
|
1570 | |
private void extractAspectDirs( Set directories, MavenProject project, File basedir, File projectBaseDir, |
1571 | |
String testOutput ) |
1572 | |
throws MojoExecutionException |
1573 | |
{ |
1574 | 0 | Xpp3Dom configuration = getAspectjConfiguration( project ); |
1575 | 0 | if ( configuration != null ) |
1576 | |
{ |
1577 | 0 | String aspectDirectory = DEFAULT_ASPECT_DIRECTORY; |
1578 | 0 | Xpp3Dom aspectDirectoryElement = configuration.getChild( ASPECT_DIRECTORY ); |
1579 | 0 | if ( aspectDirectoryElement != null ) |
1580 | |
{ |
1581 | 0 | aspectDirectory = aspectDirectoryElement.getValue(); |
1582 | |
} |
1583 | |
|
1584 | 0 | File aspectDirectoryFile = new File( basedir, aspectDirectory ); |
1585 | 0 | if ( aspectDirectoryFile.exists() && aspectDirectoryFile.isDirectory() ) |
1586 | |
{ |
1587 | 0 | String sourceRoot = |
1588 | |
IdeUtils.toRelativeAndFixSeparator( projectBaseDir, aspectDirectoryFile, |
1589 | |
!projectBaseDir.equals( basedir ) ); |
1590 | |
|
1591 | 0 | directories.add( new EclipseSourceDir( sourceRoot, null, false, false, null, null, false ) ); |
1592 | |
} |
1593 | |
|
1594 | 0 | String testAspectDirectory = DEFAULT_TEST_ASPECT_DIRECTORY; |
1595 | 0 | Xpp3Dom testAspectDirectoryElement = configuration.getChild( TEST_ASPECT_DIRECTORY ); |
1596 | 0 | if ( testAspectDirectoryElement != null ) |
1597 | |
{ |
1598 | 0 | testAspectDirectory = testAspectDirectoryElement.getValue(); |
1599 | |
} |
1600 | |
|
1601 | 0 | File testAspectDirectoryFile = new File( basedir, testAspectDirectory ); |
1602 | 0 | if ( testAspectDirectoryFile.exists() && testAspectDirectoryFile.isDirectory() ) |
1603 | |
{ |
1604 | 0 | String sourceRoot = |
1605 | |
IdeUtils.toRelativeAndFixSeparator( projectBaseDir, testAspectDirectoryFile, |
1606 | |
!projectBaseDir.equals( basedir ) ); |
1607 | |
|
1608 | 0 | directories.add( new EclipseSourceDir( sourceRoot, testOutput, false, true, null, null, false ) ); |
1609 | |
} |
1610 | |
} |
1611 | 0 | } |
1612 | |
|
1613 | |
private boolean enableAjdt( MavenProject project ) |
1614 | |
{ |
1615 | 0 | boolean enable = false; |
1616 | 0 | List buildPlugins = project.getBuildPlugins(); |
1617 | 0 | for ( Iterator it = buildPlugins.iterator(); it.hasNext(); ) |
1618 | |
{ |
1619 | 0 | Plugin plugin = (Plugin) it.next(); |
1620 | 0 | if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO ) |
1621 | |
&& plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) ) |
1622 | |
{ |
1623 | 0 | enable = true; |
1624 | 0 | break; |
1625 | |
} |
1626 | |
} |
1627 | |
|
1628 | 0 | return enable; |
1629 | |
} |
1630 | |
|
1631 | |
private Xpp3Dom getAspectjConfiguration( MavenProject project ) |
1632 | |
{ |
1633 | 0 | Xpp3Dom configuration = null; |
1634 | 0 | List buildPlugins = project.getBuildPlugins(); |
1635 | 0 | for ( Iterator it = buildPlugins.iterator(); it.hasNext(); ) |
1636 | |
{ |
1637 | 0 | Plugin plugin = (Plugin) it.next(); |
1638 | 0 | if ( plugin.getGroupId().equals( ORG_CODEHAUS_MOJO ) |
1639 | |
&& plugin.getArtifactId().equals( ASPECTJ_MAVEN_PLUGIN ) ) |
1640 | |
{ |
1641 | 0 | configuration = (Xpp3Dom) plugin.getConfiguration(); |
1642 | 0 | break; |
1643 | |
} |
1644 | |
} |
1645 | |
|
1646 | 0 | return configuration; |
1647 | |
} |
1648 | |
|
1649 | |
private void buildAspectjDeps( IdeDependency[] deps ) |
1650 | |
throws MojoExecutionException |
1651 | |
{ |
1652 | 0 | Xpp3Dom configuration = getAspectjConfiguration( executedProject ); |
1653 | 0 | if ( configuration != null ) |
1654 | |
{ |
1655 | 0 | Xpp3Dom aspectLibrariesParent = configuration.getChild( ASPECT_LIBRARIES ); |
1656 | 0 | if ( aspectLibrariesParent != null ) |
1657 | |
{ |
1658 | 0 | Xpp3Dom[] aspectLibraries = aspectLibrariesParent.getChildren( ASPECT_LIBRARY ); |
1659 | 0 | outerLoop: for ( int i = 0; i < aspectLibraries.length; i++ ) |
1660 | |
{ |
1661 | 0 | String artifactId = aspectLibraries[i].getChild( POM_ELT_ARTIFACT_ID ).getValue(); |
1662 | 0 | String groupId = aspectLibraries[i].getChild( POM_ELT_GROUP_ID ).getValue(); |
1663 | 0 | for ( int j = 0; j < deps.length; j++ ) |
1664 | |
{ |
1665 | 0 | if ( deps[j].getArtifactId().equals( artifactId ) && deps[j].getGroupId().equals( groupId ) ) |
1666 | |
{ |
1667 | 0 | deps[j].setAjdtDependency( true ); |
1668 | 0 | continue outerLoop; |
1669 | |
} |
1670 | |
} |
1671 | |
|
1672 | 0 | throw new MojoExecutionException( "AspectLibrary is not a dependency of project" ); |
1673 | |
} |
1674 | |
} |
1675 | |
} |
1676 | 0 | } |
1677 | |
|
1678 | |
private void buildAjdtWeaveDeps( IdeDependency[] deps ) |
1679 | |
throws MojoExecutionException |
1680 | |
{ |
1681 | 0 | Xpp3Dom configuration = getAspectjConfiguration( executedProject ); |
1682 | 0 | if ( configuration != null ) |
1683 | |
{ |
1684 | 0 | Xpp3Dom weaveDependenciesParent = configuration.getChild( WEAVE_DEPENDENCIES ); |
1685 | 0 | if ( weaveDependenciesParent != null ) |
1686 | |
{ |
1687 | 0 | Xpp3Dom[] weaveDependencies = weaveDependenciesParent.getChildren( WEAVE_DEPENDENCY ); |
1688 | 0 | outerLoop: for ( int i = 0; i < weaveDependencies.length; i++ ) |
1689 | |
{ |
1690 | 0 | String artifactId = weaveDependencies[i].getChild( POM_ELT_ARTIFACT_ID ).getValue(); |
1691 | 0 | String groupId = weaveDependencies[i].getChild( POM_ELT_GROUP_ID ).getValue(); |
1692 | 0 | for ( int j = 0; j < deps.length; j++ ) |
1693 | |
{ |
1694 | 0 | if ( deps[j].getArtifactId().equals( artifactId ) && deps[j].getGroupId().equals( groupId ) ) |
1695 | |
{ |
1696 | 0 | deps[j].setAjdtWeaveDependency( true ); |
1697 | 0 | continue outerLoop; |
1698 | |
} |
1699 | |
} |
1700 | |
|
1701 | 0 | throw new MojoExecutionException( "WeaveDependency is not a dependency of project" ); |
1702 | |
} |
1703 | |
} |
1704 | |
} |
1705 | 0 | } |
1706 | |
|
1707 | |
|
1708 | |
|
1709 | |
|
1710 | |
public String getProjectNameForArifact( Artifact artifact ) |
1711 | |
{ |
1712 | 0 | IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts(); |
1713 | 0 | for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ ) |
1714 | |
{ |
1715 | 0 | IdeDependency workspaceArtefact = workspaceArtefacts[index]; |
1716 | 0 | if ( workspaceArtefact.isAddedToClasspath() |
1717 | |
&& workspaceArtefact.getGroupId().equals( artifact.getGroupId() ) |
1718 | |
&& workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) ) |
1719 | |
{ |
1720 | 0 | if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) ) |
1721 | |
{ |
1722 | 0 | return workspaceArtefact.getEclipseProjectName(); |
1723 | |
} |
1724 | |
} |
1725 | |
} |
1726 | 0 | MavenProject reactorProject = getReactorProject( artifact ); |
1727 | 0 | if ( reactorProject != null ) { |
1728 | 0 | return IdeUtils.getProjectName( getProjectNameTemplateForMavenProject( reactorProject ), artifact ); |
1729 | |
} |
1730 | 0 | return IdeUtils.getProjectName( getProjectNameTemplate(), artifact ); |
1731 | |
} |
1732 | |
|
1733 | |
|
1734 | |
|
1735 | |
|
1736 | |
|
1737 | |
private String getProjectNameTemplateForMavenProject( MavenProject mavenProject ) |
1738 | |
{ |
1739 | 0 | String projectNameTemplate = null; |
1740 | 0 | boolean addVersionToProjectName = false; |
1741 | 0 | boolean addGroupIdToProjectName = false; |
1742 | |
|
1743 | 0 | Build build = mavenProject.getBuild(); |
1744 | 0 | if ( build != null ) |
1745 | |
{ |
1746 | 0 | Plugin plugin = (Plugin) build.getPluginsAsMap().get( "org.apache.maven.plugins:maven-eclipse-plugin" ); |
1747 | 0 | if ( plugin != null ) |
1748 | |
{ |
1749 | 0 | Xpp3Dom config = (Xpp3Dom) plugin.getConfiguration(); |
1750 | 0 | if ( config != null ) |
1751 | |
{ |
1752 | 0 | Xpp3Dom projectNameTemplateNode = config.getChild( "projectNameTemplate" ); |
1753 | 0 | if ( projectNameTemplateNode != null ) |
1754 | |
{ |
1755 | 0 | projectNameTemplate = projectNameTemplateNode.getValue(); |
1756 | |
} |
1757 | 0 | Xpp3Dom addVersionToProjectNameNode = config.getChild( "addVersionToProjectName" ); |
1758 | 0 | addVersionToProjectName = addVersionToProjectNameNode != null; |
1759 | 0 | Xpp3Dom addGroupIdToProjectNameNode = config.getChild( "addGroupIdToProjectName" ); |
1760 | 0 | addGroupIdToProjectName = addGroupIdToProjectNameNode != null; |
1761 | |
} |
1762 | |
} |
1763 | |
} |
1764 | 0 | return IdeUtils.calculateProjectNameTemplate(projectNameTemplate, addVersionToProjectName, addGroupIdToProjectName, getLog()); |
1765 | |
} |
1766 | |
|
1767 | |
|
1768 | |
|
1769 | |
|
1770 | |
protected final IdeDependency[] getWorkspaceArtefacts() |
1771 | |
{ |
1772 | 0 | return getWorkspaceConfiguration().getWorkspaceArtefacts(); |
1773 | |
} |
1774 | |
|
1775 | |
public final WorkspaceConfiguration getWorkspaceConfiguration() |
1776 | |
{ |
1777 | 0 | if ( workspaceConfiguration == null ) |
1778 | |
{ |
1779 | 0 | workspaceConfiguration = new WorkspaceConfiguration(); |
1780 | 0 | locateWorkspace(); |
1781 | 0 | getLog().info( Messages.getString( "EclipsePlugin.workspace", workspace ) ); |
1782 | 0 | workspaceConfiguration.setWorkspaceDirectory( workspace ); |
1783 | |
|
1784 | 0 | new ReadWorkspaceLocations().init( getLog(), workspaceConfiguration, project, wtpdefaultserver ); |
1785 | |
} |
1786 | 0 | return workspaceConfiguration; |
1787 | |
} |
1788 | |
|
1789 | |
|
1790 | |
|
1791 | |
|
1792 | |
private void locateWorkspace() |
1793 | |
{ |
1794 | 0 | if ( workspace == null ) |
1795 | |
{ |
1796 | 0 | File currentWorkingDirectory = new File( "." ).getAbsoluteFile(); |
1797 | 0 | while ( currentWorkingDirectory != null ) |
1798 | |
{ |
1799 | 0 | File metadataDirectory = new File( currentWorkingDirectory, ".metadata" ); |
1800 | 0 | logger.debug( "Checking for eclipse workspace at " + currentWorkingDirectory ); |
1801 | 0 | if ( metadataDirectory.exists() && metadataDirectory.isDirectory() ) |
1802 | |
{ |
1803 | 0 | logger.debug( " Found workspace at " + currentWorkingDirectory ); |
1804 | 0 | workspace = currentWorkingDirectory; |
1805 | 0 | return; |
1806 | |
} |
1807 | 0 | currentWorkingDirectory = currentWorkingDirectory.getParentFile(); |
1808 | |
} |
1809 | |
} |
1810 | 0 | } |
1811 | |
|
1812 | |
public final List getExcludes() |
1813 | |
{ |
1814 | 0 | return excludes; |
1815 | |
} |
1816 | |
|
1817 | |
|
1818 | |
|
1819 | |
|
1820 | |
|
1821 | |
|
1822 | |
|
1823 | |
private boolean isAvailableAsAWorkspaceProject( Artifact artifact ) |
1824 | |
{ |
1825 | 0 | IdeDependency[] workspaceArtefacts = getWorkspaceArtefacts(); |
1826 | 0 | for ( int index = 0; workspaceArtefacts != null && index < workspaceArtefacts.length; index++ ) |
1827 | |
{ |
1828 | 0 | IdeDependency workspaceArtefact = workspaceArtefacts[index]; |
1829 | 0 | if ( workspaceArtefact.getGroupId().equals( artifact.getGroupId() ) |
1830 | |
&& workspaceArtefact.getArtifactId().equals( artifact.getArtifactId() ) ) |
1831 | |
{ |
1832 | 0 | if ( workspaceArtefact.getVersion().equals( artifact.getVersion() ) ) |
1833 | |
{ |
1834 | 0 | workspaceArtefact.setAddedToClasspath( true ); |
1835 | 0 | getLog().debug( "Using workspace project: " + workspaceArtefact.getEclipseProjectName() ); |
1836 | 0 | return true; |
1837 | |
} |
1838 | |
else |
1839 | |
{ |
1840 | 0 | getLog().info( |
1841 | |
"Artifact " |
1842 | |
+ artifact.getId() |
1843 | |
+ " already available as a workspace project, but with different version. Expected: " |
1844 | |
+ artifact.getVersion() + ", found: " + workspaceArtefact.getVersion() ); |
1845 | |
} |
1846 | |
} |
1847 | |
} |
1848 | 0 | return false; |
1849 | |
} |
1850 | |
|
1851 | |
|
1852 | |
|
1853 | |
|
1854 | |
|
1855 | |
|
1856 | |
|
1857 | |
protected final boolean hasToResolveJar( Artifact art ) |
1858 | |
{ |
1859 | 0 | return !( getUseProjectReferences() && isAvailableAsAReactorProject( art ) ) |
1860 | |
|| ( limitProjectReferencesToWorkspace && !( getUseProjectReferences() && isAvailableAsAWorkspaceProject( art ) ) ); |
1861 | |
} |
1862 | |
|
1863 | |
|
1864 | |
|
1865 | |
|
1866 | |
|
1867 | |
|
1868 | |
|
1869 | |
protected final boolean useProjectReference( Artifact art ) |
1870 | |
{ |
1871 | 0 | boolean isReactorProject = getUseProjectReferences() && isAvailableAsAReactorProject( art ); |
1872 | 0 | boolean isWorkspaceProject = getUseProjectReferences() && isAvailableAsAWorkspaceProject( art ); |
1873 | 0 | return ( isReactorProject && !limitProjectReferencesToWorkspace ) || |
1874 | |
( limitProjectReferencesToWorkspace && isWorkspaceProject ) || |
1875 | |
( !isReactorProject && isWorkspaceProject ); |
1876 | |
} |
1877 | |
} |