1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.maven.plugin.ide; |
20 | |
|
21 | |
import java.io.File; |
22 | |
import java.io.IOException; |
23 | |
import java.util.ArrayList; |
24 | |
import java.util.Iterator; |
25 | |
import java.util.List; |
26 | |
|
27 | |
import org.apache.maven.artifact.Artifact; |
28 | |
import org.apache.maven.artifact.factory.ArtifactFactory; |
29 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
30 | |
import org.apache.maven.artifact.resolver.ArtifactNotFoundException; |
31 | |
import org.apache.maven.artifact.resolver.ArtifactResolutionException; |
32 | |
import org.apache.maven.artifact.resolver.ArtifactResolver; |
33 | |
import org.apache.maven.artifact.versioning.ArtifactVersion; |
34 | |
import org.apache.maven.artifact.versioning.VersionRange; |
35 | |
import org.apache.maven.model.Dependency; |
36 | |
import org.apache.maven.model.Plugin; |
37 | |
import org.apache.maven.model.PluginExecution; |
38 | |
import org.apache.maven.plugin.MojoExecutionException; |
39 | |
import org.apache.maven.plugin.eclipse.Messages; |
40 | |
import org.apache.maven.plugin.logging.Log; |
41 | |
import org.apache.maven.project.MavenProject; |
42 | |
import org.codehaus.plexus.util.FileUtils; |
43 | |
import org.codehaus.plexus.util.StringUtils; |
44 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
public class IdeUtils |
52 | |
{ |
53 | |
public static final String JAVA_1_1 = "1.1"; |
54 | |
|
55 | |
public static final String JAVA_1_2 = "1.2"; |
56 | |
|
57 | |
public static final String JAVA_1_3 = "1.3"; |
58 | |
|
59 | |
public static final String JAVA_1_4 = "1.4"; |
60 | |
|
61 | |
public static final String JAVA_5_0 = "5.0"; |
62 | |
|
63 | |
public static final String JAVA_6_0 = "6.0"; |
64 | |
|
65 | |
public static final String PROJECT_NAME_DEFAULT_TEMPLATE = "[artifactId]"; |
66 | |
|
67 | |
public static final String PROJECT_NAME_WITH_VERSION_TEMPLATE = "[artifactId]-[version]"; |
68 | |
|
69 | |
public static final String PROJECT_NAME_WITH_GROUP_TEMPLATE = "[groupId].[artifactId]"; |
70 | |
|
71 | |
public static final String PROJECT_NAME_WITH_GROUP_AND_VERSION_TEMPLATE = "[groupId].[artifactId]-[version]"; |
72 | |
|
73 | |
|
74 | |
|
75 | |
|
76 | |
private static final String ARTIFACT_MAVEN_COMPILER_PLUGIN = "maven-compiler-plugin"; |
77 | |
|
78 | |
|
79 | |
|
80 | |
|
81 | |
private static final String PROPERTY_SOURCE = "source"; |
82 | |
|
83 | |
|
84 | |
|
85 | |
|
86 | |
private static final String PROPERTY_ENCODING = "encoding"; |
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
private static final String PROPERTY_TARGET = "target"; |
92 | |
|
93 | |
|
94 | |
|
95 | |
|
96 | |
public static final String NOT_AVAILABLE_MARKER_FILE_SUFFIX = "-not-available"; |
97 | |
|
98 | |
|
99 | |
|
100 | |
|
101 | |
|
102 | |
|
103 | |
|
104 | |
public static void delete( File f, Log log ) |
105 | |
throws MojoExecutionException |
106 | |
{ |
107 | 0 | if ( f.isDirectory() ) |
108 | |
{ |
109 | 0 | log.info( Messages.getString( "EclipseCleanMojo.deletingDirectory", f.getName() ) ); |
110 | |
} |
111 | |
else |
112 | |
{ |
113 | 0 | log.info( Messages.getString( "EclipseCleanMojo.deletingFile", f.getName() ) ); |
114 | |
} |
115 | |
|
116 | 0 | if ( f.exists() ) |
117 | |
{ |
118 | 0 | if ( !f.delete() ) |
119 | |
{ |
120 | |
try |
121 | |
{ |
122 | 0 | FileUtils.forceDelete( f ); |
123 | |
} |
124 | 0 | catch ( IOException e ) |
125 | |
{ |
126 | 0 | throw new MojoExecutionException( Messages.getString( "EclipseCleanMojo.failedtodelete", |
127 | |
new Object[] { f.getName(), |
128 | |
f.getAbsolutePath() } ) ); |
129 | 0 | } |
130 | |
} |
131 | |
} |
132 | |
else |
133 | |
{ |
134 | 0 | log.debug( Messages.getString( "EclipseCleanMojo.nofilefound", f.getName() ) ); |
135 | |
} |
136 | 0 | } |
137 | |
|
138 | |
public static String getCanonicalPath( File file ) |
139 | |
throws MojoExecutionException |
140 | |
{ |
141 | |
try |
142 | |
{ |
143 | 82 | return file.getCanonicalPath(); |
144 | |
} |
145 | 0 | catch ( IOException e ) |
146 | |
{ |
147 | 0 | throw new MojoExecutionException( Messages.getString( "EclipsePlugin.cantcanonicalize", file |
148 | |
.getAbsolutePath() ), e ); |
149 | |
} |
150 | |
} |
151 | |
|
152 | |
|
153 | |
|
154 | |
|
155 | |
|
156 | |
|
157 | |
|
158 | |
public static String getCompilerPluginSetting( MavenProject project, String optionName ) |
159 | |
{ |
160 | 0 | String value = findCompilerPluginSettingInPlugins( project.getModel().getBuild().getPlugins(), optionName ); |
161 | 0 | if ( value == null && project.getModel().getBuild().getPluginManagement() != null ) |
162 | |
{ |
163 | 0 | value = |
164 | |
findCompilerPluginSettingInPlugins( project.getModel().getBuild().getPluginManagement().getPlugins(), |
165 | |
optionName ); |
166 | |
} |
167 | 0 | return value; |
168 | |
} |
169 | |
|
170 | |
|
171 | |
|
172 | |
|
173 | |
|
174 | |
|
175 | |
|
176 | |
|
177 | |
public static String getCompilerSourceVersion( MavenProject project ) |
178 | |
{ |
179 | 0 | return IdeUtils.getCompilerPluginSetting( project, PROPERTY_SOURCE ); |
180 | |
} |
181 | |
|
182 | |
|
183 | |
|
184 | |
|
185 | |
|
186 | |
|
187 | |
|
188 | |
|
189 | |
public static String getCompilerSourceEncoding( MavenProject project ) |
190 | |
{ |
191 | 0 | String value = IdeUtils.getCompilerPluginSetting( project, PROPERTY_ENCODING ); |
192 | 0 | if ( value == null ) |
193 | |
{ |
194 | 0 | project.getProperties().getProperty( "project.build.sourceEncoding" ); |
195 | |
} |
196 | 0 | return value; |
197 | |
} |
198 | |
|
199 | |
|
200 | |
|
201 | |
|
202 | |
|
203 | |
|
204 | |
|
205 | |
|
206 | |
public static String getCompilerTargetVersion( MavenProject project ) |
207 | |
{ |
208 | 0 | return IdeUtils.getCompilerPluginSetting( project, PROPERTY_TARGET ); |
209 | |
} |
210 | |
|
211 | |
|
212 | |
|
213 | |
|
214 | |
|
215 | |
|
216 | |
|
217 | |
|
218 | |
|
219 | |
|
220 | |
|
221 | |
|
222 | |
|
223 | |
|
224 | |
|
225 | |
|
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 | |
public static String getArtifactVersion( String[] artifactIds, List dependencies, int len ) |
252 | |
{ |
253 | 22 | String version = null; |
254 | 22 | ArtifactVersion artifactVersion = getArtifactVersion( artifactIds, dependencies ); |
255 | 22 | if ( artifactVersion != null ) |
256 | |
{ |
257 | 18 | StringBuffer versionBuffer = new StringBuffer(); |
258 | 18 | if( len >= 1 ) |
259 | |
{ |
260 | 18 | versionBuffer.append( artifactVersion.getMajorVersion() ); |
261 | |
} |
262 | 18 | if( len >= 2 ) |
263 | |
{ |
264 | 12 | versionBuffer.append( '.' ); |
265 | |
} |
266 | 18 | if( len >= 3 ) |
267 | |
{ |
268 | 12 | versionBuffer.append( artifactVersion.getMinorVersion() ); |
269 | |
} |
270 | 18 | if( len >= 4 ) |
271 | |
{ |
272 | 6 | versionBuffer.append( '.' ); |
273 | |
} |
274 | 18 | if( len >= 5 ) |
275 | |
{ |
276 | 6 | versionBuffer.append( artifactVersion.getIncrementalVersion() ); |
277 | |
} |
278 | 18 | version = versionBuffer.toString(); |
279 | |
} |
280 | 22 | return version; |
281 | |
} |
282 | |
|
283 | |
|
284 | |
|
285 | |
|
286 | |
|
287 | |
|
288 | |
|
289 | |
public static ArtifactVersion getArtifactVersion( String[] artifactIds, List dependencies ) |
290 | |
{ |
291 | 24 | for ( int j = 0; j < artifactIds.length; j++ ) |
292 | |
{ |
293 | 20 | String id = artifactIds[j]; |
294 | 20 | Iterator depIter = dependencies.iterator(); |
295 | 20 | while ( depIter.hasNext() ) |
296 | |
{ |
297 | 18 | Dependency dep = (Dependency) depIter.next(); |
298 | 18 | if ( id.equals( dep.getArtifactId() ) ) |
299 | |
{ |
300 | 18 | return VersionRange.createFromVersion( dep.getVersion() ).getRecommendedVersion(); |
301 | |
} |
302 | |
|
303 | 0 | } |
304 | |
} |
305 | 4 | return null; |
306 | |
} |
307 | |
|
308 | |
|
309 | |
|
310 | |
|
311 | |
|
312 | |
|
313 | |
|
314 | |
|
315 | |
|
316 | |
|
317 | |
|
318 | |
public static String getPluginSetting( MavenProject project, String pluginId, String optionName, String defaultValue ) |
319 | |
{ |
320 | 4 | Xpp3Dom dom = getPluginConfigurationDom( project, pluginId ); |
321 | 4 | if ( dom != null && dom.getChild( optionName ) != null ) |
322 | |
{ |
323 | 0 | return dom.getChild( optionName ).getValue(); |
324 | |
} |
325 | 4 | return defaultValue; |
326 | |
} |
327 | |
|
328 | |
|
329 | |
|
330 | |
|
331 | |
|
332 | |
|
333 | |
|
334 | |
|
335 | |
|
336 | |
public static Xpp3Dom getPluginConfigurationDom( MavenProject project, String pluginId ) |
337 | |
{ |
338 | |
|
339 | 4 | Plugin plugin = (org.apache.maven.model.Plugin) project.getBuild().getPluginsAsMap().get( pluginId ); |
340 | 4 | if ( plugin != null ) |
341 | |
{ |
342 | |
|
343 | 0 | return (Xpp3Dom) plugin.getConfiguration(); |
344 | |
} |
345 | 4 | return null; |
346 | |
} |
347 | |
|
348 | |
|
349 | |
|
350 | |
|
351 | |
|
352 | |
|
353 | |
|
354 | |
|
355 | |
|
356 | |
public static Xpp3Dom[] getPluginConfigurationDom( MavenProject project, String artifactId, |
357 | |
String[] subConfiguration ) |
358 | |
{ |
359 | 0 | ArrayList configurationDomList = new ArrayList(); |
360 | 0 | Xpp3Dom configuration = getPluginConfigurationDom( project, artifactId ); |
361 | 0 | if ( configuration != null ) |
362 | |
{ |
363 | 0 | configurationDomList.add( configuration ); |
364 | 0 | for ( int index = 0; !configurationDomList.isEmpty() && subConfiguration != null |
365 | 0 | && index < subConfiguration.length; index++ ) |
366 | |
{ |
367 | 0 | ArrayList newConfigurationDomList = new ArrayList(); |
368 | 0 | for ( Iterator childElement = configurationDomList.iterator(); childElement.hasNext(); ) |
369 | |
{ |
370 | 0 | Xpp3Dom child = (Xpp3Dom) childElement.next(); |
371 | 0 | Xpp3Dom[] deeperChild = child.getChildren( subConfiguration[index] ); |
372 | 0 | for ( int deeperIndex = 0; deeperIndex < deeperChild.length; deeperIndex++ ) |
373 | |
{ |
374 | 0 | if ( deeperChild[deeperIndex] != null ) |
375 | |
{ |
376 | 0 | newConfigurationDomList.add( deeperChild[deeperIndex] ); |
377 | |
} |
378 | |
} |
379 | 0 | } |
380 | 0 | configurationDomList = newConfigurationDomList; |
381 | |
} |
382 | |
} |
383 | 0 | return (Xpp3Dom[]) configurationDomList.toArray( new Xpp3Dom[configurationDomList.size()] ); |
384 | |
} |
385 | |
|
386 | |
|
387 | |
|
388 | |
|
389 | |
|
390 | |
|
391 | |
|
392 | |
|
393 | |
|
394 | |
|
395 | |
|
396 | |
|
397 | |
|
398 | |
public static String calculateProjectNameTemplate( String projectNameTemplate, boolean addVersionToProjectName, |
399 | |
boolean addGroupIdToProjectName, Log log ) |
400 | |
{ |
401 | 0 | if ( projectNameTemplate != null ) |
402 | |
{ |
403 | 0 | if ( addVersionToProjectName || addGroupIdToProjectName ) |
404 | |
{ |
405 | 0 | log.warn( "projectNameTemplate definition overrides " |
406 | |
+ "addVersionToProjectName or addGroupIdToProjectName" ); |
407 | |
} |
408 | 0 | return projectNameTemplate; |
409 | |
} |
410 | 0 | else if ( addVersionToProjectName && addGroupIdToProjectName ) |
411 | |
{ |
412 | 0 | return IdeUtils.PROJECT_NAME_WITH_GROUP_AND_VERSION_TEMPLATE; |
413 | |
} |
414 | 0 | else if ( addVersionToProjectName ) |
415 | |
{ |
416 | 0 | return IdeUtils.PROJECT_NAME_WITH_VERSION_TEMPLATE; |
417 | |
} |
418 | 0 | else if ( addGroupIdToProjectName ) |
419 | |
{ |
420 | 0 | return IdeUtils.PROJECT_NAME_WITH_GROUP_TEMPLATE; |
421 | |
} |
422 | 0 | return IdeUtils.PROJECT_NAME_DEFAULT_TEMPLATE; |
423 | |
} |
424 | |
|
425 | |
|
426 | |
|
427 | |
|
428 | |
protected static String getProjectName( String template, IdeDependency dep ) |
429 | |
{ |
430 | 8 | return getProjectName( template, dep.getGroupId(), dep.getArtifactId(), dep.getVersion() ); |
431 | |
} |
432 | |
|
433 | |
|
434 | |
|
435 | |
|
436 | |
|
437 | |
|
438 | |
|
439 | |
|
440 | |
public static String getProjectName( String template, Artifact artifact ) |
441 | |
{ |
442 | 0 | return getProjectName( template, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion() ); |
443 | |
} |
444 | |
|
445 | |
public static String getProjectName( String template, MavenProject project ) |
446 | |
{ |
447 | 0 | return getProjectName( template, project.getGroupId(), project.getArtifactId(), project.getVersion() ); |
448 | |
} |
449 | |
|
450 | |
public static String getProjectName( MavenProject project, boolean addVersionToProjectName ) |
451 | |
{ |
452 | 0 | return getProjectName( addVersionToProjectName ? PROJECT_NAME_WITH_VERSION_TEMPLATE |
453 | |
: PROJECT_NAME_DEFAULT_TEMPLATE, project ); |
454 | |
} |
455 | |
|
456 | |
|
457 | |
|
458 | |
|
459 | |
|
460 | |
public static File getNotAvailableMarkerFile( ArtifactRepository localRepository, Artifact artifact ) |
461 | |
{ |
462 | 0 | return new File( localRepository.getBasedir(), localRepository.pathOf( artifact ) |
463 | |
+ NOT_AVAILABLE_MARKER_FILE_SUFFIX ); |
464 | |
} |
465 | |
|
466 | |
|
467 | |
|
468 | |
|
469 | |
|
470 | |
|
471 | |
|
472 | |
|
473 | |
|
474 | |
|
475 | |
|
476 | |
public static Artifact resolveArtifact( ArtifactResolver artifactResolver, Artifact artifact, List remoteRepos, |
477 | |
ArtifactRepository localRepository, Log log ) |
478 | |
|
479 | |
{ |
480 | |
try |
481 | |
{ |
482 | 0 | artifactResolver.resolve( artifact, remoteRepos, localRepository ); |
483 | |
} |
484 | 0 | catch ( ArtifactNotFoundException e ) |
485 | |
{ |
486 | |
|
487 | |
|
488 | |
|
489 | |
|
490 | |
|
491 | |
|
492 | |
|
493 | |
|
494 | 0 | if ( artifact.getFile() != null && artifact.getFile().isFile() ) |
495 | |
{ |
496 | 0 | artifact.setResolved( true ); |
497 | |
} |
498 | |
} |
499 | 0 | catch ( ArtifactResolutionException e ) |
500 | |
{ |
501 | 0 | String message = |
502 | |
Messages.getString( "IdeUtils.errorresolving", new Object[] { artifact.getClassifier(), |
503 | |
artifact.getId(), e.getMessage() } ); |
504 | |
|
505 | 0 | log.warn( message ); |
506 | 0 | } |
507 | |
|
508 | 0 | return artifact; |
509 | |
} |
510 | |
|
511 | |
|
512 | |
|
513 | |
|
514 | |
|
515 | |
|
516 | |
|
517 | |
|
518 | |
|
519 | |
|
520 | |
|
521 | |
|
522 | |
|
523 | |
|
524 | |
public static Artifact createArtifactWithClassifier( String groupId, String artifactId, String version, |
525 | |
String depClassifier, String inClassifier, |
526 | |
ArtifactFactory artifactFactory ) |
527 | |
{ |
528 | 0 | String type = null; |
529 | |
|
530 | |
|
531 | 0 | if ( "sources".equals( inClassifier ) ) |
532 | |
{ |
533 | 0 | type = "java-source"; |
534 | |
} |
535 | |
else |
536 | |
{ |
537 | 0 | type = inClassifier; |
538 | |
} |
539 | |
|
540 | 0 | String finalClassifier = null; |
541 | 0 | if ( depClassifier == null ) |
542 | |
{ |
543 | 0 | finalClassifier = inClassifier; |
544 | |
} |
545 | 0 | else if ( "sources".equals( inClassifier ) && "tests".equals( depClassifier ) ) |
546 | |
{ |
547 | |
|
548 | 0 | finalClassifier = "test-sources"; |
549 | |
} |
550 | |
else |
551 | |
{ |
552 | 0 | finalClassifier = depClassifier + "-" + inClassifier; |
553 | |
} |
554 | |
|
555 | 0 | return artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, finalClassifier ); |
556 | |
} |
557 | |
|
558 | |
public static String resolveJavaVersion( MavenProject project ) |
559 | |
{ |
560 | 0 | String version = IdeUtils.getCompilerTargetVersion( project ); |
561 | 0 | if ( version == null ) |
562 | |
{ |
563 | 0 | version = IdeUtils.getCompilerSourceVersion( project ); |
564 | |
} |
565 | |
|
566 | 0 | if ( "1.5".equals( version ) ) |
567 | |
{ |
568 | 0 | version = IdeUtils.JAVA_5_0; |
569 | |
} |
570 | 0 | else if ( "1.6".equals( version ) ) |
571 | |
{ |
572 | 0 | version = IdeUtils.JAVA_6_0; |
573 | |
} |
574 | 0 | else if ( version != null && version.length() == 1 ) |
575 | |
{ |
576 | 0 | version = version + ".0"; |
577 | |
} |
578 | |
|
579 | 0 | return version == null ? IdeUtils.JAVA_1_4 : version; |
580 | |
} |
581 | |
|
582 | |
public static String toRelativeAndFixSeparator( File basedir, File fileToAdd, boolean replaceSlashesWithDashes ) |
583 | |
throws MojoExecutionException |
584 | |
{ |
585 | 40 | if ( !fileToAdd.isAbsolute() ) |
586 | |
{ |
587 | 18 | fileToAdd = new File( basedir, fileToAdd.getPath() ); |
588 | |
} |
589 | |
|
590 | 40 | String basedirPath = getCanonicalPath( basedir ); |
591 | 40 | String absolutePath = getCanonicalPath( fileToAdd ); |
592 | |
|
593 | 40 | String relative = null; |
594 | |
|
595 | 40 | if ( absolutePath.equals( basedirPath ) ) |
596 | |
{ |
597 | 0 | relative = "."; |
598 | |
} |
599 | 40 | else if ( absolutePath.startsWith( basedirPath ) ) |
600 | |
{ |
601 | |
|
602 | |
|
603 | |
|
604 | |
|
605 | |
|
606 | |
|
607 | 40 | int length = basedirPath.length() + 1; |
608 | 40 | if ( basedirPath.endsWith( "\\" ) ) |
609 | |
{ |
610 | 0 | length--; |
611 | |
} |
612 | 40 | relative = absolutePath.substring( length ); |
613 | 40 | } |
614 | |
else |
615 | |
{ |
616 | 0 | relative = absolutePath; |
617 | |
} |
618 | |
|
619 | 40 | relative = fixSeparator( relative ); |
620 | |
|
621 | 40 | if ( replaceSlashesWithDashes ) |
622 | |
{ |
623 | 4 | relative = StringUtils.replace( relative, '/', '-' ); |
624 | 4 | relative = StringUtils.replace( relative, ':', '-' ); |
625 | |
} |
626 | |
|
627 | 40 | return relative; |
628 | |
} |
629 | |
|
630 | |
|
631 | |
|
632 | |
|
633 | |
|
634 | |
|
635 | |
|
636 | |
public static String fixSeparator( String filename ) |
637 | |
{ |
638 | 88 | return StringUtils.replace( filename, '\\', '/' ); |
639 | |
} |
640 | |
|
641 | |
|
642 | |
|
643 | |
|
644 | |
|
645 | |
|
646 | |
|
647 | |
|
648 | |
|
649 | |
|
650 | |
|
651 | |
public static String fixWindowsDriveURI( String input ) |
652 | |
{ |
653 | 0 | return input.replaceAll( "file:([a-zA-Z]):", "file:/$1:" ); |
654 | |
} |
655 | |
|
656 | |
|
657 | |
|
658 | |
|
659 | |
|
660 | |
|
661 | |
|
662 | |
private static String findCompilerPluginSettingInPlugins( List plugins, String optionName ) |
663 | |
{ |
664 | 0 | String value = null; |
665 | |
|
666 | 0 | for ( Iterator it = plugins.iterator(); it.hasNext(); ) |
667 | |
{ |
668 | 0 | Plugin plugin = (Plugin) it.next(); |
669 | |
|
670 | 0 | if ( plugin.getArtifactId().equals( ARTIFACT_MAVEN_COMPILER_PLUGIN ) ) |
671 | |
{ |
672 | |
|
673 | 0 | Xpp3Dom o = (Xpp3Dom) plugin.getConfiguration(); |
674 | |
|
675 | |
|
676 | 0 | if ( o != null && o.getChild( optionName ) != null ) |
677 | |
{ |
678 | 0 | value = o.getChild( optionName ).getValue(); |
679 | |
} |
680 | |
|
681 | 0 | List executions = plugin.getExecutions(); |
682 | |
|
683 | |
|
684 | 0 | for ( Iterator iter = executions.iterator(); iter.hasNext(); ) |
685 | |
{ |
686 | 0 | PluginExecution execution = (PluginExecution) iter.next(); |
687 | |
|
688 | |
|
689 | 0 | o = (Xpp3Dom) execution.getConfiguration(); |
690 | |
|
691 | 0 | if ( o != null && o.getChild( optionName ) != null ) |
692 | |
{ |
693 | 0 | value = o.getChild( optionName ).getValue(); |
694 | |
} |
695 | 0 | } |
696 | |
} |
697 | 0 | } |
698 | 0 | return value; |
699 | |
} |
700 | |
|
701 | |
private static String getProjectName( String template, String groupId, String artifactId, String version ) |
702 | |
{ |
703 | 8 | String s = template; |
704 | 8 | s = s.replaceAll( "\\[groupId\\]", groupId ); |
705 | 8 | s = s.replaceAll( "\\[artifactId\\]", artifactId ); |
706 | 8 | s = s.replaceAll( "\\[version\\]", version ); |
707 | 8 | return s; |
708 | |
} |
709 | |
|
710 | |
private IdeUtils() |
711 | 0 | { |
712 | |
|
713 | 0 | } |
714 | |
} |