| 1 | |
package org.apache.maven.project; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
import java.io.File; |
| 23 | |
import java.io.IOException; |
| 24 | |
import java.io.Writer; |
| 25 | |
import java.util.ArrayList; |
| 26 | |
import java.util.Collections; |
| 27 | |
import java.util.Enumeration; |
| 28 | |
import java.util.HashMap; |
| 29 | |
import java.util.Iterator; |
| 30 | |
import java.util.LinkedHashSet; |
| 31 | |
import java.util.List; |
| 32 | |
import java.util.Map; |
| 33 | |
import java.util.Properties; |
| 34 | |
import java.util.Set; |
| 35 | |
|
| 36 | |
import org.apache.maven.artifact.Artifact; |
| 37 | |
import org.apache.maven.artifact.ArtifactUtils; |
| 38 | |
import org.apache.maven.artifact.DependencyResolutionRequiredException; |
| 39 | |
import org.apache.maven.artifact.versioning.ManagedVersionMap; |
| 40 | |
import org.apache.maven.artifact.factory.ArtifactFactory; |
| 41 | |
import org.apache.maven.artifact.repository.ArtifactRepository; |
| 42 | |
import org.apache.maven.artifact.resolver.filter.ArtifactFilter; |
| 43 | |
import org.apache.maven.model.Build; |
| 44 | |
import org.apache.maven.model.CiManagement; |
| 45 | |
import org.apache.maven.model.Contributor; |
| 46 | |
import org.apache.maven.model.Dependency; |
| 47 | |
import org.apache.maven.model.DependencyManagement; |
| 48 | |
import org.apache.maven.model.Developer; |
| 49 | |
import org.apache.maven.model.DistributionManagement; |
| 50 | |
import org.apache.maven.model.IssueManagement; |
| 51 | |
import org.apache.maven.model.License; |
| 52 | |
import org.apache.maven.model.MailingList; |
| 53 | |
import org.apache.maven.model.Model; |
| 54 | |
import org.apache.maven.model.Organization; |
| 55 | |
import org.apache.maven.model.Plugin; |
| 56 | |
import org.apache.maven.model.PluginExecution; |
| 57 | |
import org.apache.maven.model.PluginManagement; |
| 58 | |
import org.apache.maven.model.Prerequisites; |
| 59 | |
import org.apache.maven.model.ReportPlugin; |
| 60 | |
import org.apache.maven.model.ReportSet; |
| 61 | |
import org.apache.maven.model.Reporting; |
| 62 | |
import org.apache.maven.model.Resource; |
| 63 | |
import org.apache.maven.model.Scm; |
| 64 | |
import org.apache.maven.model.io.xpp3.MavenXpp3Writer; |
| 65 | |
import org.apache.maven.project.artifact.ActiveProjectArtifact; |
| 66 | |
import org.apache.maven.project.artifact.InvalidDependencyVersionException; |
| 67 | |
import org.apache.maven.project.artifact.MavenMetadataSource; |
| 68 | |
import org.codehaus.plexus.logging.Logger; |
| 69 | |
import org.codehaus.plexus.util.xml.Xpp3Dom; |
| 70 | |
|
| 71 | |
|
| 72 | |
|
| 73 | |
|
| 74 | |
|
| 75 | |
|
| 76 | |
|
| 77 | |
|
| 78 | |
|
| 79 | |
|
| 80 | |
|
| 81 | |
|
| 82 | |
|
| 83 | |
|
| 84 | |
public class MavenProject |
| 85 | |
implements Cloneable |
| 86 | |
{ |
| 87 | |
public static final String EMPTY_PROJECT_GROUP_ID = "unknown"; |
| 88 | |
|
| 89 | |
public static final String EMPTY_PROJECT_ARTIFACT_ID = "empty-project"; |
| 90 | |
|
| 91 | |
public static final String EMPTY_PROJECT_VERSION = "0"; |
| 92 | |
|
| 93 | |
private Model model; |
| 94 | |
|
| 95 | |
private MavenProject parent; |
| 96 | |
|
| 97 | |
private File file; |
| 98 | |
|
| 99 | |
private Set artifacts; |
| 100 | |
|
| 101 | |
private Artifact parentArtifact; |
| 102 | |
|
| 103 | |
private Set pluginArtifacts; |
| 104 | |
|
| 105 | |
private List remoteArtifactRepositories; |
| 106 | |
|
| 107 | 555 | private List collectedProjects = Collections.EMPTY_LIST; |
| 108 | |
|
| 109 | |
private List attachedArtifacts; |
| 110 | |
|
| 111 | |
private MavenProject executionProject; |
| 112 | |
|
| 113 | 555 | private List compileSourceRoots = new ArrayList(); |
| 114 | |
|
| 115 | 555 | private List testCompileSourceRoots = new ArrayList(); |
| 116 | |
|
| 117 | 555 | private List scriptSourceRoots = new ArrayList(); |
| 118 | |
|
| 119 | |
private List pluginArtifactRepositories; |
| 120 | |
|
| 121 | |
private ArtifactRepository releaseArtifactRepository; |
| 122 | |
|
| 123 | |
private ArtifactRepository snapshotArtifactRepository; |
| 124 | |
|
| 125 | 555 | private List activeProfiles = new ArrayList(); |
| 126 | |
|
| 127 | |
private Set dependencyArtifacts; |
| 128 | |
|
| 129 | |
private Artifact artifact; |
| 130 | |
|
| 131 | |
|
| 132 | |
private Map artifactMap; |
| 133 | |
|
| 134 | |
private Model originalModel; |
| 135 | |
|
| 136 | |
private Map pluginArtifactMap; |
| 137 | |
|
| 138 | |
private Set reportArtifacts; |
| 139 | |
|
| 140 | |
private Map reportArtifactMap; |
| 141 | |
|
| 142 | |
private Set extensionArtifacts; |
| 143 | |
|
| 144 | |
private Map extensionArtifactMap; |
| 145 | |
|
| 146 | |
private Map managedVersionMap; |
| 147 | |
|
| 148 | 555 | private Map projectReferences = new HashMap(); |
| 149 | |
|
| 150 | |
private boolean executionRoot; |
| 151 | |
|
| 152 | |
private Map moduleAdjustments; |
| 153 | |
|
| 154 | |
private File basedir; |
| 155 | |
|
| 156 | |
private Logger logger; |
| 157 | |
|
| 158 | |
private ProjectBuilderConfiguration projectBuilderConfiguration; |
| 159 | |
|
| 160 | |
public MavenProject() |
| 161 | 1 | { |
| 162 | 1 | Model model = new Model(); |
| 163 | |
|
| 164 | 1 | model.setGroupId( EMPTY_PROJECT_GROUP_ID ); |
| 165 | 1 | model.setArtifactId( EMPTY_PROJECT_ARTIFACT_ID ); |
| 166 | 1 | model.setVersion( EMPTY_PROJECT_VERSION ); |
| 167 | |
|
| 168 | 1 | this.setModel( model ); |
| 169 | 1 | } |
| 170 | |
|
| 171 | |
public MavenProject( Model model ) |
| 172 | 157 | { |
| 173 | 157 | this.setModel( model ); |
| 174 | 157 | } |
| 175 | |
|
| 176 | |
public MavenProject( Model model, Logger logger ) |
| 177 | 253 | { |
| 178 | 253 | this.setModel( model ); |
| 179 | 253 | this.setLogger( logger ); |
| 180 | 253 | } |
| 181 | |
|
| 182 | |
|
| 183 | |
|
| 184 | |
|
| 185 | |
public MavenProject( MavenProject project ) |
| 186 | 144 | { |
| 187 | 144 | deepCopy( project ); |
| 188 | 144 | } |
| 189 | |
|
| 190 | |
private final void deepCopy(MavenProject project){ |
| 191 | |
|
| 192 | |
|
| 193 | |
|
| 194 | 147 | setFile( project.getFile() ); |
| 195 | |
|
| 196 | |
|
| 197 | |
|
| 198 | 147 | if ( project.getDependencyArtifacts() != null ) |
| 199 | |
{ |
| 200 | 1 | setDependencyArtifacts( Collections.unmodifiableSet( project.getDependencyArtifacts() ) ); |
| 201 | |
} |
| 202 | |
|
| 203 | 147 | if ( project.getArtifacts() != null ) |
| 204 | |
{ |
| 205 | 147 | setArtifacts( Collections.unmodifiableSet( project.getArtifacts() ) ); |
| 206 | |
} |
| 207 | |
|
| 208 | 147 | if ( project.getPluginArtifacts() != null ) |
| 209 | |
{ |
| 210 | 3 | setPluginArtifacts( Collections.unmodifiableSet( project.getPluginArtifacts() ) ); |
| 211 | |
} |
| 212 | |
|
| 213 | 147 | if ( project.getReportArtifacts() != null ) |
| 214 | |
{ |
| 215 | 3 | setReportArtifacts( Collections.unmodifiableSet( project.getReportArtifacts() ) ); |
| 216 | |
} |
| 217 | |
|
| 218 | 147 | if ( project.getExtensionArtifacts() != null ) |
| 219 | |
{ |
| 220 | 3 | setExtensionArtifacts( Collections.unmodifiableSet( project.getExtensionArtifacts() ) ); |
| 221 | |
} |
| 222 | |
|
| 223 | 147 | setParentArtifact( ( project.getParentArtifact() ) ); |
| 224 | |
|
| 225 | 147 | if ( project.getRemoteArtifactRepositories() != null ) |
| 226 | |
{ |
| 227 | 3 | setRemoteArtifactRepositories( Collections.unmodifiableList( project.getRemoteArtifactRepositories() ) ); |
| 228 | |
} |
| 229 | |
|
| 230 | 147 | if ( project.getPluginArtifactRepositories() != null ) |
| 231 | |
{ |
| 232 | 3 | setPluginArtifactRepositories( ( Collections.unmodifiableList( project.getPluginArtifactRepositories() ) ) ); |
| 233 | |
} |
| 234 | |
|
| 235 | 147 | if ( project.getCollectedProjects() != null ) |
| 236 | |
{ |
| 237 | 147 | setCollectedProjects( ( Collections.unmodifiableList( project.getCollectedProjects() ) ) ); |
| 238 | |
} |
| 239 | |
|
| 240 | 147 | if ( project.getActiveProfiles() != null ) |
| 241 | |
{ |
| 242 | 147 | setActiveProfiles( ( Collections.unmodifiableList( project.getActiveProfiles() ) ) ); |
| 243 | |
} |
| 244 | |
|
| 245 | 147 | if ( project.getAttachedArtifacts() != null ) |
| 246 | |
{ |
| 247 | |
|
| 248 | 147 | setAttachedArtifacts( new ArrayList( project.getAttachedArtifacts() ) ); |
| 249 | |
} |
| 250 | |
|
| 251 | 147 | if ( project.getCompileSourceRoots() != null ) |
| 252 | |
{ |
| 253 | |
|
| 254 | 147 | setCompileSourceRoots( ( new ArrayList( project.getCompileSourceRoots() ) ) ); |
| 255 | |
} |
| 256 | |
|
| 257 | 147 | if ( project.getTestCompileSourceRoots() != null ) |
| 258 | |
{ |
| 259 | 147 | setTestCompileSourceRoots( ( new ArrayList( project.getTestCompileSourceRoots() ) ) ); |
| 260 | |
} |
| 261 | |
|
| 262 | 147 | if ( project.getScriptSourceRoots() != null ) |
| 263 | |
{ |
| 264 | 147 | setScriptSourceRoots( ( new ArrayList( project.getScriptSourceRoots() ) ) ); |
| 265 | |
} |
| 266 | |
|
| 267 | 147 | setModel( ( ModelUtils.cloneModel( project.getModel() ) ) ); |
| 268 | |
|
| 269 | 147 | if ( project.getOriginalModel() != null ) |
| 270 | |
{ |
| 271 | 147 | setOriginalModel( ( ModelUtils.cloneModel( project.getOriginalModel() ) ) ); |
| 272 | |
} |
| 273 | |
|
| 274 | 147 | setExecutionRoot( project.isExecutionRoot() ); |
| 275 | |
|
| 276 | 147 | if ( project.getArtifact() != null ) |
| 277 | |
{ |
| 278 | 3 | setArtifact( ArtifactUtils.copyArtifact( project.getArtifact() ) ); |
| 279 | |
} |
| 280 | |
|
| 281 | 147 | if ( project.getManagedVersionMap() != null ) |
| 282 | |
{ |
| 283 | 3 | setManagedVersionMap( new ManagedVersionMap( project.getManagedVersionMap() ) ); |
| 284 | |
} |
| 285 | |
|
| 286 | 147 | if ( project.getReleaseArtifactRepository() != null ) |
| 287 | |
{ |
| 288 | 1 | setReleaseArtifactRepository( project.getReleaseArtifactRepository() ); |
| 289 | |
} |
| 290 | |
|
| 291 | 147 | if ( project.getSnapshotArtifactRepository() != null ) |
| 292 | |
{ |
| 293 | 1 | setSnapshotArtifactRepository( project.getSnapshotArtifactRepository() ); |
| 294 | |
} |
| 295 | |
|
| 296 | 147 | if ( project.isConcrete() ) |
| 297 | |
{ |
| 298 | 0 | setDynamicBuild( ModelUtils.cloneBuild( project.getDynamicBuild() ) ); |
| 299 | 0 | setOriginalInterpolatedBuild( ModelUtils.cloneBuild( project.getOriginalInterpolatedBuild() ) ); |
| 300 | |
|
| 301 | 0 | List dynamicRoots = project.getDynamicCompileSourceRoots(); |
| 302 | 0 | if ( dynamicRoots != null ) |
| 303 | |
{ |
| 304 | 0 | setDynamicCompileSourceRoots( new ArrayList( dynamicRoots ) ); |
| 305 | 0 | setOriginalInterpolatedCompileSourceRoots( new ArrayList( project.getOriginalInterpolatedCompileSourceRoots() ) ); |
| 306 | |
} |
| 307 | |
|
| 308 | 0 | dynamicRoots = project.getDynamicTestCompileSourceRoots(); |
| 309 | 0 | if ( dynamicRoots != null ) |
| 310 | |
{ |
| 311 | 0 | setDynamicTestCompileSourceRoots( new ArrayList( dynamicRoots ) ); |
| 312 | 0 | setOriginalInterpolatedTestCompileSourceRoots( new ArrayList( project.getOriginalInterpolatedTestCompileSourceRoots() ) ); |
| 313 | |
} |
| 314 | |
|
| 315 | 0 | dynamicRoots = project.getDynamicScriptSourceRoots(); |
| 316 | 0 | if ( dynamicRoots != null ) |
| 317 | |
{ |
| 318 | 0 | setDynamicScriptSourceRoots( new ArrayList( dynamicRoots ) ); |
| 319 | 0 | setOriginalInterpolatedScriptSourceRoots( new ArrayList( project.getOriginalInterpolatedScriptSourceRoots() ) ); |
| 320 | |
} |
| 321 | |
} |
| 322 | |
|
| 323 | 147 | preservedProperties = project.preservedProperties; |
| 324 | 147 | preservedBasedir = project.preservedBasedir; |
| 325 | 147 | setConcrete( project.isConcrete() ); |
| 326 | 147 | } |
| 327 | |
|
| 328 | |
public String getModulePathAdjustment( MavenProject moduleProject ) throws IOException |
| 329 | |
{ |
| 330 | |
|
| 331 | |
|
| 332 | |
|
| 333 | |
|
| 334 | |
|
| 335 | |
|
| 336 | |
|
| 337 | 146 | String module = moduleProject.getArtifactId(); |
| 338 | |
|
| 339 | 146 | File moduleFile = moduleProject.getFile(); |
| 340 | |
|
| 341 | 146 | if ( moduleFile != null ) |
| 342 | |
{ |
| 343 | 105 | File moduleDir = moduleFile.getCanonicalFile().getParentFile(); |
| 344 | |
|
| 345 | 105 | module = moduleDir.getName(); |
| 346 | |
} |
| 347 | |
|
| 348 | 146 | if ( moduleAdjustments == null ) |
| 349 | |
{ |
| 350 | 146 | moduleAdjustments = new HashMap(); |
| 351 | |
|
| 352 | 146 | List modules = getModules(); |
| 353 | 146 | if ( modules != null ) |
| 354 | |
{ |
| 355 | 146 | for ( Iterator it = modules.iterator(); it.hasNext(); ) |
| 356 | |
{ |
| 357 | 19 | String modulePath = (String) it.next(); |
| 358 | 19 | String moduleName = modulePath; |
| 359 | |
|
| 360 | 19 | if ( moduleName.endsWith( "/" ) || moduleName.endsWith( "\\" ) ) |
| 361 | |
{ |
| 362 | 0 | moduleName = moduleName.substring( 0, moduleName.length() - 1 ); |
| 363 | |
} |
| 364 | |
|
| 365 | 19 | int lastSlash = moduleName.lastIndexOf( '/' ); |
| 366 | |
|
| 367 | 19 | if ( lastSlash < 0 ) |
| 368 | |
{ |
| 369 | 17 | lastSlash = moduleName.lastIndexOf( '\\' ); |
| 370 | |
} |
| 371 | |
|
| 372 | 19 | String adjustment = null; |
| 373 | |
|
| 374 | 19 | if ( lastSlash > -1 ) |
| 375 | |
{ |
| 376 | 2 | moduleName = moduleName.substring( lastSlash + 1 ); |
| 377 | 2 | adjustment = modulePath.substring( 0, lastSlash ); |
| 378 | |
} |
| 379 | |
|
| 380 | 19 | moduleAdjustments.put( moduleName, adjustment ); |
| 381 | 19 | } |
| 382 | |
} |
| 383 | |
} |
| 384 | |
|
| 385 | 146 | return (String) moduleAdjustments.get( module ); |
| 386 | |
} |
| 387 | |
|
| 388 | |
|
| 389 | |
|
| 390 | |
|
| 391 | |
|
| 392 | |
public Artifact getArtifact() |
| 393 | |
{ |
| 394 | 253 | return artifact; |
| 395 | |
} |
| 396 | |
|
| 397 | |
public void setArtifact( Artifact artifact ) |
| 398 | |
{ |
| 399 | 112 | this.artifact = artifact; |
| 400 | 112 | } |
| 401 | |
|
| 402 | |
|
| 403 | |
public Model getModel() |
| 404 | |
{ |
| 405 | 4231 | return model; |
| 406 | |
} |
| 407 | |
|
| 408 | |
public MavenProject getParent() |
| 409 | |
{ |
| 410 | 279 | return parent; |
| 411 | |
} |
| 412 | |
|
| 413 | |
public void setParent( MavenProject parent ) |
| 414 | |
{ |
| 415 | 80 | this.parent = parent; |
| 416 | 80 | } |
| 417 | |
|
| 418 | |
public void setRemoteArtifactRepositories( List remoteArtifactRepositories ) |
| 419 | |
{ |
| 420 | 112 | this.remoteArtifactRepositories = remoteArtifactRepositories; |
| 421 | 112 | } |
| 422 | |
|
| 423 | |
public List getRemoteArtifactRepositories() |
| 424 | |
{ |
| 425 | 274 | return remoteArtifactRepositories; |
| 426 | |
} |
| 427 | |
|
| 428 | |
public boolean hasParent() |
| 429 | |
{ |
| 430 | 0 | return getParent() != null; |
| 431 | |
} |
| 432 | |
|
| 433 | |
public File getFile() |
| 434 | |
{ |
| 435 | 358 | return file; |
| 436 | |
} |
| 437 | |
|
| 438 | |
public void setFile( File file ) |
| 439 | |
{ |
| 440 | 354 | if ( file == null ) |
| 441 | |
{ |
| 442 | 82 | return; |
| 443 | |
} |
| 444 | |
|
| 445 | 272 | if ( basedir == null ) |
| 446 | |
{ |
| 447 | 269 | basedir = file.getParentFile(); |
| 448 | |
} |
| 449 | |
|
| 450 | 272 | this.file = file; |
| 451 | 272 | } |
| 452 | |
|
| 453 | |
public void setBasedir( File basedir ) |
| 454 | |
{ |
| 455 | 0 | this.basedir = basedir; |
| 456 | 0 | } |
| 457 | |
|
| 458 | |
public File getBasedir() |
| 459 | |
{ |
| 460 | 845 | return basedir; |
| 461 | |
} |
| 462 | |
|
| 463 | |
public void setDependencies( List dependencies ) |
| 464 | |
{ |
| 465 | 0 | getModel().setDependencies( dependencies ); |
| 466 | 0 | } |
| 467 | |
|
| 468 | |
public List getDependencies() |
| 469 | |
{ |
| 470 | 130 | return getModel().getDependencies(); |
| 471 | |
} |
| 472 | |
|
| 473 | |
public DependencyManagement getDependencyManagement() |
| 474 | |
{ |
| 475 | 101 | return getModel().getDependencyManagement(); |
| 476 | |
} |
| 477 | |
|
| 478 | |
|
| 479 | |
|
| 480 | |
|
| 481 | |
|
| 482 | |
public void addCompileSourceRoot( String path ) |
| 483 | |
{ |
| 484 | 62 | if ( path != null ) |
| 485 | |
{ |
| 486 | 62 | path = path.trim(); |
| 487 | 62 | if ( path.length() != 0 ) |
| 488 | |
{ |
| 489 | 62 | if ( !getCompileSourceRoots().contains( path ) ) |
| 490 | |
{ |
| 491 | 62 | getCompileSourceRoots().add( path ); |
| 492 | |
} |
| 493 | |
} |
| 494 | |
} |
| 495 | 62 | } |
| 496 | |
|
| 497 | |
public void addScriptSourceRoot( String path ) |
| 498 | |
{ |
| 499 | 61 | if ( path != null ) |
| 500 | |
{ |
| 501 | 61 | path = path.trim(); |
| 502 | 61 | if ( path.length() != 0 ) |
| 503 | |
{ |
| 504 | 61 | if ( !getScriptSourceRoots().contains( path ) ) |
| 505 | |
{ |
| 506 | 61 | getScriptSourceRoots().add( path ); |
| 507 | |
} |
| 508 | |
} |
| 509 | |
} |
| 510 | 61 | } |
| 511 | |
|
| 512 | |
public void addTestCompileSourceRoot( String path ) |
| 513 | |
{ |
| 514 | 61 | if ( path != null ) |
| 515 | |
{ |
| 516 | 61 | path = path.trim(); |
| 517 | 61 | if ( path.length() != 0 ) |
| 518 | |
{ |
| 519 | 61 | if ( !getTestCompileSourceRoots().contains( path ) ) |
| 520 | |
{ |
| 521 | 61 | getTestCompileSourceRoots().add( path ); |
| 522 | |
} |
| 523 | |
} |
| 524 | |
} |
| 525 | 61 | } |
| 526 | |
|
| 527 | |
public List getCompileSourceRoots() |
| 528 | |
{ |
| 529 | 466 | return compileSourceRoots; |
| 530 | |
} |
| 531 | |
|
| 532 | |
public List getScriptSourceRoots() |
| 533 | |
{ |
| 534 | 461 | return scriptSourceRoots; |
| 535 | |
} |
| 536 | |
|
| 537 | |
public List getTestCompileSourceRoots() |
| 538 | |
{ |
| 539 | 461 | return testCompileSourceRoots; |
| 540 | |
} |
| 541 | |
|
| 542 | |
public List getCompileClasspathElements() |
| 543 | |
throws DependencyResolutionRequiredException |
| 544 | |
{ |
| 545 | 0 | List list = new ArrayList( getArtifacts().size() ); |
| 546 | |
|
| 547 | 0 | list.add( getBuild().getOutputDirectory() ); |
| 548 | |
|
| 549 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 550 | |
{ |
| 551 | 0 | Artifact a = (Artifact) i.next(); |
| 552 | |
|
| 553 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 554 | |
{ |
| 555 | |
|
| 556 | 0 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || |
| 557 | |
Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 558 | |
{ |
| 559 | 0 | addArtifactPath( a, list ); |
| 560 | |
} |
| 561 | |
} |
| 562 | 0 | } |
| 563 | 0 | return list; |
| 564 | |
} |
| 565 | |
|
| 566 | |
public List getCompileArtifacts() |
| 567 | |
{ |
| 568 | 1 | List list = new ArrayList( getArtifacts().size() ); |
| 569 | |
|
| 570 | 1 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 571 | |
{ |
| 572 | 2 | Artifact a = (Artifact) i.next(); |
| 573 | |
|
| 574 | |
|
| 575 | 2 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 576 | |
{ |
| 577 | |
|
| 578 | 2 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || |
| 579 | |
Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 580 | |
{ |
| 581 | 2 | list.add( a ); |
| 582 | |
} |
| 583 | |
} |
| 584 | 2 | } |
| 585 | 1 | return list; |
| 586 | |
} |
| 587 | |
|
| 588 | |
public List getCompileDependencies() |
| 589 | |
{ |
| 590 | 0 | Set artifacts = getArtifacts(); |
| 591 | |
|
| 592 | 0 | if ( artifacts == null || artifacts.isEmpty() ) |
| 593 | |
{ |
| 594 | 0 | return Collections.EMPTY_LIST; |
| 595 | |
} |
| 596 | |
|
| 597 | 0 | List list = new ArrayList( artifacts.size() ); |
| 598 | |
|
| 599 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 600 | |
{ |
| 601 | 0 | Artifact a = (Artifact) i.next(); |
| 602 | |
|
| 603 | |
|
| 604 | 0 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || |
| 605 | |
Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 606 | |
{ |
| 607 | 0 | Dependency dependency = new Dependency(); |
| 608 | |
|
| 609 | 0 | dependency.setArtifactId( a.getArtifactId() ); |
| 610 | 0 | dependency.setGroupId( a.getGroupId() ); |
| 611 | 0 | dependency.setVersion( a.getVersion() ); |
| 612 | 0 | dependency.setScope( a.getScope() ); |
| 613 | 0 | dependency.setType( a.getType() ); |
| 614 | 0 | dependency.setClassifier( a.getClassifier() ); |
| 615 | |
|
| 616 | 0 | list.add( dependency ); |
| 617 | |
} |
| 618 | 0 | } |
| 619 | 0 | return list; |
| 620 | |
} |
| 621 | |
|
| 622 | |
public List getTestClasspathElements() |
| 623 | |
throws DependencyResolutionRequiredException |
| 624 | |
{ |
| 625 | 1 | List list = new ArrayList( getArtifacts().size() + 1 ); |
| 626 | |
|
| 627 | 1 | list.add( getBuild().getTestOutputDirectory() ); |
| 628 | |
|
| 629 | 1 | list.add( getBuild().getOutputDirectory() ); |
| 630 | |
|
| 631 | 1 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 632 | |
{ |
| 633 | 0 | Artifact a = (Artifact) i.next(); |
| 634 | |
|
| 635 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 636 | |
{ |
| 637 | |
|
| 638 | |
|
| 639 | |
|
| 640 | |
|
| 641 | |
|
| 642 | |
|
| 643 | |
|
| 644 | 0 | File file = a.getFile(); |
| 645 | 0 | if ( file == null ) |
| 646 | |
{ |
| 647 | 0 | throw new DependencyResolutionRequiredException( a ); |
| 648 | |
} |
| 649 | 0 | list.add( file.getPath() ); |
| 650 | |
} |
| 651 | 0 | } |
| 652 | 1 | return list; |
| 653 | |
} |
| 654 | |
|
| 655 | |
public List getTestArtifacts() |
| 656 | |
{ |
| 657 | 0 | List list = new ArrayList( getArtifacts().size() ); |
| 658 | |
|
| 659 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 660 | |
{ |
| 661 | 0 | Artifact a = (Artifact) i.next(); |
| 662 | |
|
| 663 | |
|
| 664 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 665 | |
{ |
| 666 | |
|
| 667 | |
|
| 668 | |
|
| 669 | |
|
| 670 | |
|
| 671 | |
|
| 672 | |
|
| 673 | |
|
| 674 | |
|
| 675 | 0 | list.add( a ); |
| 676 | |
} |
| 677 | 0 | } |
| 678 | 0 | return list; |
| 679 | |
} |
| 680 | |
|
| 681 | |
public List getTestDependencies() |
| 682 | |
{ |
| 683 | 0 | Set artifacts = getArtifacts(); |
| 684 | |
|
| 685 | 0 | if ( artifacts == null || artifacts.isEmpty() ) |
| 686 | |
{ |
| 687 | 0 | return Collections.EMPTY_LIST; |
| 688 | |
} |
| 689 | |
|
| 690 | 0 | List list = new ArrayList( artifacts.size() ); |
| 691 | |
|
| 692 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 693 | |
{ |
| 694 | 0 | Artifact a = (Artifact) i.next(); |
| 695 | |
|
| 696 | |
|
| 697 | |
|
| 698 | |
|
| 699 | |
|
| 700 | |
|
| 701 | |
|
| 702 | |
|
| 703 | |
|
| 704 | 0 | Dependency dependency = new Dependency(); |
| 705 | |
|
| 706 | 0 | dependency.setArtifactId( a.getArtifactId() ); |
| 707 | 0 | dependency.setGroupId( a.getGroupId() ); |
| 708 | 0 | dependency.setVersion( a.getVersion() ); |
| 709 | 0 | dependency.setScope( a.getScope() ); |
| 710 | 0 | dependency.setType( a.getType() ); |
| 711 | 0 | dependency.setClassifier( a.getClassifier() ); |
| 712 | |
|
| 713 | 0 | list.add( dependency ); |
| 714 | 0 | } |
| 715 | 0 | return list; |
| 716 | |
} |
| 717 | |
|
| 718 | |
public List getRuntimeClasspathElements() |
| 719 | |
throws DependencyResolutionRequiredException |
| 720 | |
{ |
| 721 | 0 | List list = new ArrayList( getArtifacts().size() + 1 ); |
| 722 | |
|
| 723 | 0 | list.add( getBuild().getOutputDirectory() ); |
| 724 | |
|
| 725 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 726 | |
{ |
| 727 | 0 | Artifact a = (Artifact) i.next(); |
| 728 | |
|
| 729 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 730 | |
{ |
| 731 | |
|
| 732 | 0 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) |
| 733 | |
{ |
| 734 | 0 | File file = a.getFile(); |
| 735 | 0 | if ( file == null ) |
| 736 | |
{ |
| 737 | 0 | throw new DependencyResolutionRequiredException( a ); |
| 738 | |
} |
| 739 | 0 | list.add( file.getPath() ); |
| 740 | |
} |
| 741 | |
} |
| 742 | 0 | } |
| 743 | 0 | return list; |
| 744 | |
} |
| 745 | |
|
| 746 | |
public List getRuntimeArtifacts() |
| 747 | |
{ |
| 748 | 0 | List list = new ArrayList( getArtifacts().size() ); |
| 749 | |
|
| 750 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 751 | |
{ |
| 752 | 0 | Artifact a = (Artifact) i.next(); |
| 753 | |
|
| 754 | |
|
| 755 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 756 | |
{ |
| 757 | |
|
| 758 | 0 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) |
| 759 | |
{ |
| 760 | 0 | list.add( a ); |
| 761 | |
} |
| 762 | |
} |
| 763 | 0 | } |
| 764 | 0 | return list; |
| 765 | |
} |
| 766 | |
|
| 767 | |
public List getRuntimeDependencies() |
| 768 | |
{ |
| 769 | 0 | Set artifacts = getArtifacts(); |
| 770 | |
|
| 771 | 0 | if ( artifacts == null || artifacts.isEmpty() ) |
| 772 | |
{ |
| 773 | 0 | return Collections.EMPTY_LIST; |
| 774 | |
} |
| 775 | |
|
| 776 | 0 | List list = new ArrayList( artifacts.size() ); |
| 777 | |
|
| 778 | 0 | for ( Iterator i = artifacts.iterator(); i.hasNext(); ) |
| 779 | |
{ |
| 780 | 0 | Artifact a = (Artifact) i.next(); |
| 781 | |
|
| 782 | |
|
| 783 | 0 | if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_RUNTIME.equals( a.getScope() ) ) |
| 784 | |
{ |
| 785 | 0 | Dependency dependency = new Dependency(); |
| 786 | |
|
| 787 | 0 | dependency.setArtifactId( a.getArtifactId() ); |
| 788 | 0 | dependency.setGroupId( a.getGroupId() ); |
| 789 | 0 | dependency.setVersion( a.getVersion() ); |
| 790 | 0 | dependency.setScope( a.getScope() ); |
| 791 | 0 | dependency.setType( a.getType() ); |
| 792 | 0 | dependency.setClassifier( a.getClassifier() ); |
| 793 | |
|
| 794 | 0 | list.add( dependency ); |
| 795 | |
} |
| 796 | 0 | } |
| 797 | 0 | return list; |
| 798 | |
} |
| 799 | |
|
| 800 | |
public List getSystemClasspathElements() |
| 801 | |
throws DependencyResolutionRequiredException |
| 802 | |
{ |
| 803 | 0 | List list = new ArrayList( getArtifacts().size() ); |
| 804 | |
|
| 805 | 0 | list.add( getBuild().getOutputDirectory() ); |
| 806 | |
|
| 807 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 808 | |
{ |
| 809 | 0 | Artifact a = (Artifact) i.next(); |
| 810 | |
|
| 811 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 812 | |
{ |
| 813 | |
|
| 814 | 0 | if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 815 | |
{ |
| 816 | 0 | addArtifactPath( a, list ); |
| 817 | |
} |
| 818 | |
} |
| 819 | 0 | } |
| 820 | 0 | return list; |
| 821 | |
} |
| 822 | |
|
| 823 | |
public List getSystemArtifacts() |
| 824 | |
{ |
| 825 | 0 | List list = new ArrayList( getArtifacts().size() ); |
| 826 | |
|
| 827 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 828 | |
{ |
| 829 | 0 | Artifact a = (Artifact) i.next(); |
| 830 | |
|
| 831 | |
|
| 832 | 0 | if ( a.getArtifactHandler().isAddedToClasspath() ) |
| 833 | |
{ |
| 834 | |
|
| 835 | 0 | if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 836 | |
{ |
| 837 | 0 | list.add( a ); |
| 838 | |
} |
| 839 | |
} |
| 840 | 0 | } |
| 841 | 0 | return list; |
| 842 | |
} |
| 843 | |
|
| 844 | |
public List getSystemDependencies() |
| 845 | |
{ |
| 846 | 0 | Set artifacts = getArtifacts(); |
| 847 | |
|
| 848 | 0 | if ( artifacts == null || artifacts.isEmpty() ) |
| 849 | |
{ |
| 850 | 0 | return Collections.EMPTY_LIST; |
| 851 | |
} |
| 852 | |
|
| 853 | 0 | List list = new ArrayList( artifacts.size() ); |
| 854 | |
|
| 855 | 0 | for ( Iterator i = getArtifacts().iterator(); i.hasNext(); ) |
| 856 | |
{ |
| 857 | 0 | Artifact a = (Artifact) i.next(); |
| 858 | |
|
| 859 | |
|
| 860 | 0 | if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) |
| 861 | |
{ |
| 862 | 0 | Dependency dependency = new Dependency(); |
| 863 | |
|
| 864 | 0 | dependency.setArtifactId( a.getArtifactId() ); |
| 865 | 0 | dependency.setGroupId( a.getGroupId() ); |
| 866 | 0 | dependency.setVersion( a.getVersion() ); |
| 867 | 0 | dependency.setScope( a.getScope() ); |
| 868 | 0 | dependency.setType( a.getType() ); |
| 869 | 0 | dependency.setClassifier( a.getClassifier() ); |
| 870 | |
|
| 871 | 0 | list.add( dependency ); |
| 872 | |
} |
| 873 | 0 | } |
| 874 | 0 | return list; |
| 875 | |
} |
| 876 | |
|
| 877 | |
|
| 878 | |
|
| 879 | |
|
| 880 | |
|
| 881 | |
public void setModelVersion( String pomVersion ) |
| 882 | |
{ |
| 883 | 0 | getModel().setModelVersion( pomVersion ); |
| 884 | 0 | } |
| 885 | |
|
| 886 | |
public String getModelVersion() |
| 887 | |
{ |
| 888 | 4 | return getModel().getModelVersion(); |
| 889 | |
} |
| 890 | |
|
| 891 | |
public String getId() |
| 892 | |
{ |
| 893 | 90 | return getModel().getId(); |
| 894 | |
} |
| 895 | |
|
| 896 | |
public void setGroupId( String groupId ) |
| 897 | |
{ |
| 898 | 0 | getModel().setGroupId( groupId ); |
| 899 | 0 | } |
| 900 | |
|
| 901 | |
public String getGroupId() |
| 902 | |
{ |
| 903 | 567 | String groupId = getModel().getGroupId(); |
| 904 | |
|
| 905 | 567 | if ( ( groupId == null ) && ( getModel().getParent() != null ) ) |
| 906 | |
{ |
| 907 | 6 | groupId = getModel().getParent().getGroupId(); |
| 908 | |
} |
| 909 | |
|
| 910 | 567 | return groupId; |
| 911 | |
} |
| 912 | |
|
| 913 | |
public void setArtifactId( String artifactId ) |
| 914 | |
{ |
| 915 | 0 | getModel().setArtifactId( artifactId ); |
| 916 | 0 | } |
| 917 | |
|
| 918 | |
public String getArtifactId() |
| 919 | |
{ |
| 920 | 711 | return getModel().getArtifactId(); |
| 921 | |
} |
| 922 | |
|
| 923 | |
public void setName( String name ) |
| 924 | |
{ |
| 925 | 0 | getModel().setName( name ); |
| 926 | 0 | } |
| 927 | |
|
| 928 | |
public String getName() |
| 929 | |
{ |
| 930 | |
|
| 931 | 2 | if ( getModel().getName() != null ) |
| 932 | |
{ |
| 933 | 2 | return getModel().getName(); |
| 934 | |
} |
| 935 | |
else |
| 936 | |
{ |
| 937 | 0 | return "Unnamed - " + getId(); |
| 938 | |
} |
| 939 | |
} |
| 940 | |
|
| 941 | |
public void setVersion( String version ) |
| 942 | |
{ |
| 943 | 0 | getModel().setVersion( version ); |
| 944 | 0 | } |
| 945 | |
|
| 946 | |
public String getVersion() |
| 947 | |
{ |
| 948 | 449 | String version = getModel().getVersion(); |
| 949 | |
|
| 950 | 449 | if ( ( version == null ) && ( getModel().getParent() != null ) ) |
| 951 | |
{ |
| 952 | 6 | version = getModel().getParent().getVersion(); |
| 953 | |
} |
| 954 | |
|
| 955 | 449 | return version; |
| 956 | |
} |
| 957 | |
|
| 958 | |
public String getPackaging() |
| 959 | |
{ |
| 960 | 218 | return getModel().getPackaging(); |
| 961 | |
} |
| 962 | |
|
| 963 | |
public void setPackaging( String packaging ) |
| 964 | |
{ |
| 965 | 0 | getModel().setPackaging( packaging ); |
| 966 | 0 | } |
| 967 | |
|
| 968 | |
public void setInceptionYear( String inceptionYear ) |
| 969 | |
{ |
| 970 | 0 | getModel().setInceptionYear( inceptionYear ); |
| 971 | 0 | } |
| 972 | |
|
| 973 | |
public String getInceptionYear() |
| 974 | |
{ |
| 975 | 2 | return getModel().getInceptionYear(); |
| 976 | |
} |
| 977 | |
|
| 978 | |
public void setUrl( String url ) |
| 979 | |
{ |
| 980 | 0 | getModel().setUrl( url ); |
| 981 | 0 | } |
| 982 | |
|
| 983 | |
public String getUrl() |
| 984 | |
{ |
| 985 | 0 | return getModel().getUrl(); |
| 986 | |
} |
| 987 | |
|
| 988 | |
public Prerequisites getPrerequisites() |
| 989 | |
{ |
| 990 | 0 | return getModel().getPrerequisites(); |
| 991 | |
} |
| 992 | |
|
| 993 | |
public void setIssueManagement( IssueManagement issueManagement ) |
| 994 | |
{ |
| 995 | 0 | getModel().setIssueManagement( issueManagement ); |
| 996 | 0 | } |
| 997 | |
|
| 998 | |
public CiManagement getCiManagement() |
| 999 | |
{ |
| 1000 | 0 | return getModel().getCiManagement(); |
| 1001 | |
} |
| 1002 | |
|
| 1003 | |
public void setCiManagement( CiManagement ciManagement ) |
| 1004 | |
{ |
| 1005 | 0 | getModel().setCiManagement( ciManagement ); |
| 1006 | 0 | } |
| 1007 | |
|
| 1008 | |
public IssueManagement getIssueManagement() |
| 1009 | |
{ |
| 1010 | 0 | return getModel().getIssueManagement(); |
| 1011 | |
} |
| 1012 | |
|
| 1013 | |
public void setDistributionManagement( DistributionManagement distributionManagement ) |
| 1014 | |
{ |
| 1015 | 0 | getModel().setDistributionManagement( distributionManagement ); |
| 1016 | 0 | } |
| 1017 | |
|
| 1018 | |
public DistributionManagement getDistributionManagement() |
| 1019 | |
{ |
| 1020 | 129 | return getModel().getDistributionManagement(); |
| 1021 | |
} |
| 1022 | |
|
| 1023 | |
public void setDescription( String description ) |
| 1024 | |
{ |
| 1025 | 0 | getModel().setDescription( description ); |
| 1026 | 0 | } |
| 1027 | |
|
| 1028 | |
public String getDescription() |
| 1029 | |
{ |
| 1030 | 0 | return getModel().getDescription(); |
| 1031 | |
} |
| 1032 | |
|
| 1033 | |
public void setOrganization( Organization organization ) |
| 1034 | |
{ |
| 1035 | 0 | getModel().setOrganization( organization ); |
| 1036 | 0 | } |
| 1037 | |
|
| 1038 | |
public Organization getOrganization() |
| 1039 | |
{ |
| 1040 | 7 | return getModel().getOrganization(); |
| 1041 | |
} |
| 1042 | |
|
| 1043 | |
public void setScm( Scm scm ) |
| 1044 | |
{ |
| 1045 | 0 | getModel().setScm( scm ); |
| 1046 | 0 | } |
| 1047 | |
|
| 1048 | |
public Scm getScm() |
| 1049 | |
{ |
| 1050 | 2 | return getModel().getScm(); |
| 1051 | |
} |
| 1052 | |
|
| 1053 | |
public void setMailingLists( List mailingLists ) |
| 1054 | |
{ |
| 1055 | 0 | getModel().setMailingLists( mailingLists ); |
| 1056 | 0 | } |
| 1057 | |
|
| 1058 | |
public List getMailingLists() |
| 1059 | |
{ |
| 1060 | 2 | return getModel().getMailingLists(); |
| 1061 | |
} |
| 1062 | |
|
| 1063 | |
public void addMailingList( MailingList mailingList ) |
| 1064 | |
{ |
| 1065 | 0 | getModel().addMailingList( mailingList ); |
| 1066 | 0 | } |
| 1067 | |
|
| 1068 | |
public void setDevelopers( List developers ) |
| 1069 | |
{ |
| 1070 | 0 | getModel().setDevelopers( developers ); |
| 1071 | 0 | } |
| 1072 | |
|
| 1073 | |
public List getDevelopers() |
| 1074 | |
{ |
| 1075 | 0 | return getModel().getDevelopers(); |
| 1076 | |
} |
| 1077 | |
|
| 1078 | |
public void addDeveloper( Developer developer ) |
| 1079 | |
{ |
| 1080 | 0 | getModel().addDeveloper( developer ); |
| 1081 | 0 | } |
| 1082 | |
|
| 1083 | |
public void setContributors( List contributors ) |
| 1084 | |
{ |
| 1085 | 0 | getModel().setContributors( contributors ); |
| 1086 | 0 | } |
| 1087 | |
|
| 1088 | |
public List getContributors() |
| 1089 | |
{ |
| 1090 | 0 | return getModel().getContributors(); |
| 1091 | |
} |
| 1092 | |
|
| 1093 | |
public void addContributor( Contributor contributor ) |
| 1094 | |
{ |
| 1095 | 0 | getModel().addContributor( contributor ); |
| 1096 | 0 | } |
| 1097 | |
|
| 1098 | |
public void setBuild( Build build ) |
| 1099 | |
{ |
| 1100 | 23 | getModel().setBuild( build ); |
| 1101 | 23 | } |
| 1102 | |
|
| 1103 | |
public Build getBuild() |
| 1104 | |
{ |
| 1105 | 284 | return getModelBuild(); |
| 1106 | |
} |
| 1107 | |
|
| 1108 | |
public List getResources() |
| 1109 | |
{ |
| 1110 | 0 | return getBuild().getResources(); |
| 1111 | |
} |
| 1112 | |
|
| 1113 | |
public List getTestResources() |
| 1114 | |
{ |
| 1115 | 0 | return getBuild().getTestResources(); |
| 1116 | |
} |
| 1117 | |
|
| 1118 | |
public void addResource( Resource resource ) |
| 1119 | |
{ |
| 1120 | 0 | getBuild().addResource( resource ); |
| 1121 | 0 | } |
| 1122 | |
|
| 1123 | |
public void addTestResource( Resource testResource ) |
| 1124 | |
{ |
| 1125 | 0 | getBuild().addTestResource( testResource ); |
| 1126 | 0 | } |
| 1127 | |
|
| 1128 | |
public void setReporting( Reporting reporting ) |
| 1129 | |
{ |
| 1130 | 0 | getModel().setReporting( reporting ); |
| 1131 | 0 | } |
| 1132 | |
|
| 1133 | |
public Reporting getReporting() |
| 1134 | |
{ |
| 1135 | 0 | return getModel().getReporting(); |
| 1136 | |
} |
| 1137 | |
|
| 1138 | |
public void setLicenses( List licenses ) |
| 1139 | |
{ |
| 1140 | 0 | getModel().setLicenses( licenses ); |
| 1141 | 0 | } |
| 1142 | |
|
| 1143 | |
public List getLicenses() |
| 1144 | |
{ |
| 1145 | 0 | return getModel().getLicenses(); |
| 1146 | |
} |
| 1147 | |
|
| 1148 | |
public void addLicense( License license ) |
| 1149 | |
{ |
| 1150 | 0 | getModel().addLicense( license ); |
| 1151 | 0 | } |
| 1152 | |
|
| 1153 | |
public void setArtifacts( Set artifacts ) |
| 1154 | |
{ |
| 1155 | 177 | this.artifacts = artifacts; |
| 1156 | |
|
| 1157 | |
|
| 1158 | 177 | this.artifactMap = null; |
| 1159 | 177 | } |
| 1160 | |
|
| 1161 | |
|
| 1162 | |
|
| 1163 | |
|
| 1164 | |
|
| 1165 | |
|
| 1166 | |
|
| 1167 | |
|
| 1168 | |
public Set getArtifacts() |
| 1169 | |
{ |
| 1170 | 342 | return artifacts == null ? Collections.EMPTY_SET : artifacts; |
| 1171 | |
} |
| 1172 | |
|
| 1173 | |
public Map getArtifactMap() |
| 1174 | |
{ |
| 1175 | 9 | if ( artifactMap == null ) |
| 1176 | |
{ |
| 1177 | 9 | artifactMap = ArtifactUtils.artifactMapByVersionlessId( getArtifacts() ); |
| 1178 | |
} |
| 1179 | |
|
| 1180 | 9 | return artifactMap; |
| 1181 | |
} |
| 1182 | |
|
| 1183 | |
public void setPluginArtifacts( Set pluginArtifacts ) |
| 1184 | |
{ |
| 1185 | 112 | this.pluginArtifacts = pluginArtifacts; |
| 1186 | |
|
| 1187 | 112 | this.pluginArtifactMap = null; |
| 1188 | 112 | } |
| 1189 | |
|
| 1190 | |
public Set getPluginArtifacts() |
| 1191 | |
{ |
| 1192 | 150 | return pluginArtifacts; |
| 1193 | |
} |
| 1194 | |
|
| 1195 | |
public Map getPluginArtifactMap() |
| 1196 | |
{ |
| 1197 | 0 | if ( pluginArtifactMap == null ) |
| 1198 | |
{ |
| 1199 | 0 | pluginArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getPluginArtifacts() ); |
| 1200 | |
} |
| 1201 | |
|
| 1202 | 0 | return pluginArtifactMap; |
| 1203 | |
} |
| 1204 | |
|
| 1205 | |
public void setReportArtifacts( Set reportArtifacts ) |
| 1206 | |
{ |
| 1207 | 112 | this.reportArtifacts = reportArtifacts; |
| 1208 | |
|
| 1209 | 112 | this.reportArtifactMap = null; |
| 1210 | 112 | } |
| 1211 | |
|
| 1212 | |
public Set getReportArtifacts() |
| 1213 | |
{ |
| 1214 | 150 | return reportArtifacts; |
| 1215 | |
} |
| 1216 | |
|
| 1217 | |
public Map getReportArtifactMap() |
| 1218 | |
{ |
| 1219 | 0 | if ( reportArtifactMap == null ) |
| 1220 | |
{ |
| 1221 | 0 | reportArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getReportArtifacts() ); |
| 1222 | |
} |
| 1223 | |
|
| 1224 | 0 | return reportArtifactMap; |
| 1225 | |
} |
| 1226 | |
|
| 1227 | |
public void setExtensionArtifacts( Set extensionArtifacts ) |
| 1228 | |
{ |
| 1229 | 112 | this.extensionArtifacts = extensionArtifacts; |
| 1230 | |
|
| 1231 | 112 | this.extensionArtifactMap = null; |
| 1232 | 112 | } |
| 1233 | |
|
| 1234 | |
public Set getExtensionArtifacts() |
| 1235 | |
{ |
| 1236 | 150 | return this.extensionArtifacts; |
| 1237 | |
} |
| 1238 | |
|
| 1239 | |
public Map getExtensionArtifactMap() |
| 1240 | |
{ |
| 1241 | 0 | if ( extensionArtifactMap == null ) |
| 1242 | |
{ |
| 1243 | 0 | extensionArtifactMap = ArtifactUtils.artifactMapByVersionlessId( getExtensionArtifacts() ); |
| 1244 | |
} |
| 1245 | |
|
| 1246 | 0 | return extensionArtifactMap; |
| 1247 | |
} |
| 1248 | |
|
| 1249 | |
public void setParentArtifact( Artifact parentArtifact ) |
| 1250 | |
{ |
| 1251 | 222 | this.parentArtifact = parentArtifact; |
| 1252 | 222 | } |
| 1253 | |
|
| 1254 | |
public Artifact getParentArtifact() |
| 1255 | |
{ |
| 1256 | 147 | return parentArtifact; |
| 1257 | |
} |
| 1258 | |
|
| 1259 | |
public List getRepositories() |
| 1260 | |
{ |
| 1261 | 1 | return getModel().getRepositories(); |
| 1262 | |
} |
| 1263 | |
|
| 1264 | |
|
| 1265 | |
|
| 1266 | |
|
| 1267 | |
|
| 1268 | |
public List getReportPlugins() |
| 1269 | |
{ |
| 1270 | 144 | if ( getModel().getReporting() == null ) |
| 1271 | |
{ |
| 1272 | 35 | return null; |
| 1273 | |
} |
| 1274 | 109 | return getModel().getReporting().getPlugins(); |
| 1275 | |
|
| 1276 | |
} |
| 1277 | |
|
| 1278 | |
public List getBuildPlugins() |
| 1279 | |
{ |
| 1280 | 146 | if ( getModel().getBuild() == null ) |
| 1281 | |
{ |
| 1282 | 30 | return null; |
| 1283 | |
} |
| 1284 | 116 | return getModel().getBuild().getPlugins(); |
| 1285 | |
} |
| 1286 | |
|
| 1287 | |
public List getModules() |
| 1288 | |
{ |
| 1289 | 146 | return getModel().getModules(); |
| 1290 | |
} |
| 1291 | |
|
| 1292 | |
public PluginManagement getPluginManagement() |
| 1293 | |
{ |
| 1294 | 0 | PluginManagement pluginMgmt = null; |
| 1295 | |
|
| 1296 | 0 | Build build = getModel().getBuild(); |
| 1297 | 0 | if ( build != null ) |
| 1298 | |
{ |
| 1299 | 0 | pluginMgmt = build.getPluginManagement(); |
| 1300 | |
} |
| 1301 | |
|
| 1302 | 0 | return pluginMgmt; |
| 1303 | |
} |
| 1304 | |
|
| 1305 | |
private Build getModelBuild() |
| 1306 | |
{ |
| 1307 | 286 | Build build = getModel().getBuild(); |
| 1308 | |
|
| 1309 | 286 | if ( build == null ) |
| 1310 | |
{ |
| 1311 | 31 | build = new Build(); |
| 1312 | |
|
| 1313 | 31 | getModel().setBuild( build ); |
| 1314 | |
} |
| 1315 | |
|
| 1316 | 286 | return build; |
| 1317 | |
} |
| 1318 | |
|
| 1319 | |
public void addPlugin( Plugin plugin ) |
| 1320 | |
{ |
| 1321 | 1 | Build build = getModelBuild(); |
| 1322 | |
|
| 1323 | 1 | if ( !build.getPluginsAsMap().containsKey( plugin.getKey() ) ) |
| 1324 | |
{ |
| 1325 | 1 | injectPluginManagementInfo( plugin ); |
| 1326 | |
|
| 1327 | 1 | build.addPlugin( plugin ); |
| 1328 | 1 | build.flushPluginMap(); |
| 1329 | |
} |
| 1330 | 1 | } |
| 1331 | |
|
| 1332 | |
public void injectPluginManagementInfo( Plugin plugin ) |
| 1333 | |
{ |
| 1334 | 1 | PluginManagement pm = getModelBuild().getPluginManagement(); |
| 1335 | |
|
| 1336 | 1 | if ( pm != null ) |
| 1337 | |
{ |
| 1338 | 1 | Map pmByKey = pm.getPluginsAsMap(); |
| 1339 | |
|
| 1340 | 1 | String pluginKey = plugin.getKey(); |
| 1341 | |
|
| 1342 | 1 | if ( pmByKey != null && pmByKey.containsKey( pluginKey ) ) |
| 1343 | |
{ |
| 1344 | 0 | Plugin pmPlugin = (Plugin) pmByKey.get( pluginKey ); |
| 1345 | |
|
| 1346 | 0 | ModelUtils.mergePluginDefinitions( plugin, pmPlugin, false ); |
| 1347 | |
} |
| 1348 | |
} |
| 1349 | 1 | } |
| 1350 | |
|
| 1351 | |
public List getCollectedProjects() |
| 1352 | |
{ |
| 1353 | 294 | return collectedProjects; |
| 1354 | |
} |
| 1355 | |
|
| 1356 | |
public void setCollectedProjects( List collectedProjects ) |
| 1357 | |
{ |
| 1358 | 147 | this.collectedProjects = collectedProjects; |
| 1359 | 147 | } |
| 1360 | |
|
| 1361 | |
public void setPluginArtifactRepositories( List pluginArtifactRepositories ) |
| 1362 | |
{ |
| 1363 | 112 | this.pluginArtifactRepositories = pluginArtifactRepositories; |
| 1364 | 112 | } |
| 1365 | |
|
| 1366 | |
|
| 1367 | |
|
| 1368 | |
|
| 1369 | |
|
| 1370 | |
public List getPluginArtifactRepositories() |
| 1371 | |
{ |
| 1372 | 150 | return pluginArtifactRepositories; |
| 1373 | |
} |
| 1374 | |
|
| 1375 | |
public ArtifactRepository getDistributionManagementArtifactRepository() |
| 1376 | |
{ |
| 1377 | 1 | return getArtifact().isSnapshot() && ( getSnapshotArtifactRepository() != null ) ? getSnapshotArtifactRepository() |
| 1378 | |
: getReleaseArtifactRepository(); |
| 1379 | |
} |
| 1380 | |
|
| 1381 | |
public List getPluginRepositories() |
| 1382 | |
{ |
| 1383 | 0 | return getModel().getPluginRepositories(); |
| 1384 | |
} |
| 1385 | |
|
| 1386 | |
public void setActiveProfiles( List activeProfiles ) |
| 1387 | |
{ |
| 1388 | 509 | this.activeProfiles.addAll( activeProfiles ); |
| 1389 | 509 | } |
| 1390 | |
|
| 1391 | |
public List getActiveProfiles() |
| 1392 | |
{ |
| 1393 | 403 | return activeProfiles; |
| 1394 | |
} |
| 1395 | |
|
| 1396 | |
public void addAttachedArtifact( Artifact artifact ) |
| 1397 | |
{ |
| 1398 | 0 | getAttachedArtifacts().add( artifact ); |
| 1399 | 0 | } |
| 1400 | |
|
| 1401 | |
public List getAttachedArtifacts() |
| 1402 | |
{ |
| 1403 | 294 | if ( attachedArtifacts == null ) |
| 1404 | |
{ |
| 1405 | 147 | attachedArtifacts = new ArrayList(); |
| 1406 | |
} |
| 1407 | 294 | return attachedArtifacts; |
| 1408 | |
} |
| 1409 | |
|
| 1410 | |
public Xpp3Dom getGoalConfiguration( String pluginGroupId, String pluginArtifactId, String executionId, |
| 1411 | |
String goalId ) |
| 1412 | |
{ |
| 1413 | 0 | Xpp3Dom dom = null; |
| 1414 | |
|
| 1415 | |
|
| 1416 | |
|
| 1417 | |
|
| 1418 | |
|
| 1419 | |
|
| 1420 | |
|
| 1421 | 0 | if ( getBuildPlugins() != null ) |
| 1422 | |
{ |
| 1423 | 0 | for ( Iterator iterator = getBuildPlugins().iterator(); iterator.hasNext(); ) |
| 1424 | |
{ |
| 1425 | 0 | Plugin plugin = (Plugin) iterator.next(); |
| 1426 | |
|
| 1427 | 0 | if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) ) |
| 1428 | |
{ |
| 1429 | 0 | dom = (Xpp3Dom) plugin.getConfiguration(); |
| 1430 | |
|
| 1431 | 0 | if ( executionId != null ) |
| 1432 | |
{ |
| 1433 | 0 | PluginExecution execution = (PluginExecution) plugin.getExecutionsAsMap().get( executionId ); |
| 1434 | 0 | if ( execution != null ) |
| 1435 | |
{ |
| 1436 | 0 | Xpp3Dom executionConfiguration = (Xpp3Dom) execution.getConfiguration(); |
| 1437 | 0 | if ( executionConfiguration != null ) |
| 1438 | |
{ |
| 1439 | 0 | Xpp3Dom newDom = new Xpp3Dom( executionConfiguration ); |
| 1440 | 0 | dom = Xpp3Dom.mergeXpp3Dom( newDom, dom ); |
| 1441 | |
} |
| 1442 | |
} |
| 1443 | 0 | } |
| 1444 | |
break; |
| 1445 | |
} |
| 1446 | 0 | } |
| 1447 | |
} |
| 1448 | |
|
| 1449 | |
|
| 1450 | |
|
| 1451 | |
|
| 1452 | |
|
| 1453 | |
|
| 1454 | |
|
| 1455 | |
|
| 1456 | |
|
| 1457 | |
|
| 1458 | |
|
| 1459 | |
|
| 1460 | |
|
| 1461 | |
|
| 1462 | |
|
| 1463 | |
|
| 1464 | |
|
| 1465 | |
|
| 1466 | |
|
| 1467 | |
|
| 1468 | |
|
| 1469 | |
|
| 1470 | |
|
| 1471 | |
|
| 1472 | |
|
| 1473 | |
|
| 1474 | |
|
| 1475 | |
|
| 1476 | |
|
| 1477 | |
|
| 1478 | |
|
| 1479 | |
|
| 1480 | 0 | if ( dom != null ) |
| 1481 | |
{ |
| 1482 | |
|
| 1483 | 0 | dom = new Xpp3Dom( dom ); |
| 1484 | |
} |
| 1485 | |
|
| 1486 | 0 | return dom; |
| 1487 | |
} |
| 1488 | |
|
| 1489 | |
public Xpp3Dom getReportConfiguration( String pluginGroupId, String pluginArtifactId, String reportSetId ) |
| 1490 | |
{ |
| 1491 | 0 | Xpp3Dom dom = null; |
| 1492 | |
|
| 1493 | |
|
| 1494 | |
|
| 1495 | |
|
| 1496 | |
|
| 1497 | |
|
| 1498 | |
|
| 1499 | 0 | if ( getReportPlugins() != null ) |
| 1500 | |
{ |
| 1501 | 0 | for ( Iterator iterator = getReportPlugins().iterator(); iterator.hasNext(); ) |
| 1502 | |
{ |
| 1503 | 0 | ReportPlugin plugin = (ReportPlugin) iterator.next(); |
| 1504 | |
|
| 1505 | 0 | if ( pluginGroupId.equals( plugin.getGroupId() ) && pluginArtifactId.equals( plugin.getArtifactId() ) ) |
| 1506 | |
{ |
| 1507 | 0 | dom = (Xpp3Dom) plugin.getConfiguration(); |
| 1508 | |
|
| 1509 | 0 | if ( reportSetId != null ) |
| 1510 | |
{ |
| 1511 | 0 | ReportSet reportSet = (ReportSet) plugin.getReportSetsAsMap().get( reportSetId ); |
| 1512 | 0 | if ( reportSet != null ) |
| 1513 | |
{ |
| 1514 | 0 | Xpp3Dom executionConfiguration = (Xpp3Dom) reportSet.getConfiguration(); |
| 1515 | 0 | if ( executionConfiguration != null ) |
| 1516 | |
{ |
| 1517 | 0 | Xpp3Dom newDom = new Xpp3Dom( executionConfiguration ); |
| 1518 | 0 | dom = Xpp3Dom.mergeXpp3Dom( newDom, dom ); |
| 1519 | |
} |
| 1520 | |
} |
| 1521 | 0 | } |
| 1522 | |
break; |
| 1523 | |
} |
| 1524 | 0 | } |
| 1525 | |
} |
| 1526 | |
|
| 1527 | 0 | if ( dom != null ) |
| 1528 | |
{ |
| 1529 | |
|
| 1530 | 0 | dom = new Xpp3Dom( dom ); |
| 1531 | |
} |
| 1532 | |
|
| 1533 | 0 | return dom; |
| 1534 | |
} |
| 1535 | |
|
| 1536 | |
public MavenProject getExecutionProject() |
| 1537 | |
{ |
| 1538 | 23 | return executionProject; |
| 1539 | |
} |
| 1540 | |
|
| 1541 | |
public void setExecutionProject( MavenProject executionProject ) |
| 1542 | |
{ |
| 1543 | 0 | this.executionProject = executionProject; |
| 1544 | 0 | } |
| 1545 | |
|
| 1546 | |
public void writeModel( Writer writer ) |
| 1547 | |
throws IOException |
| 1548 | |
{ |
| 1549 | 0 | MavenXpp3Writer pomWriter = new MavenXpp3Writer(); |
| 1550 | |
|
| 1551 | 0 | pomWriter.write( writer, getModel() ); |
| 1552 | 0 | } |
| 1553 | |
|
| 1554 | |
public void writeOriginalModel( Writer writer ) |
| 1555 | |
throws IOException |
| 1556 | |
{ |
| 1557 | 0 | MavenXpp3Writer pomWriter = new MavenXpp3Writer(); |
| 1558 | |
|
| 1559 | 0 | pomWriter.write( writer, getOriginalModel() ); |
| 1560 | 0 | } |
| 1561 | |
|
| 1562 | |
|
| 1563 | |
|
| 1564 | |
|
| 1565 | |
|
| 1566 | |
|
| 1567 | |
public Set getDependencyArtifacts() |
| 1568 | |
{ |
| 1569 | 176 | return dependencyArtifacts; |
| 1570 | |
} |
| 1571 | |
|
| 1572 | |
public void setDependencyArtifacts( Set dependencyArtifacts ) |
| 1573 | |
{ |
| 1574 | 29 | this.dependencyArtifacts = dependencyArtifacts; |
| 1575 | 29 | } |
| 1576 | |
|
| 1577 | |
public void setReleaseArtifactRepository( ArtifactRepository releaseArtifactRepository ) |
| 1578 | |
{ |
| 1579 | 2 | this.releaseArtifactRepository = releaseArtifactRepository; |
| 1580 | 2 | } |
| 1581 | |
|
| 1582 | |
public void setSnapshotArtifactRepository( ArtifactRepository snapshotArtifactRepository ) |
| 1583 | |
{ |
| 1584 | 2 | this.snapshotArtifactRepository = snapshotArtifactRepository; |
| 1585 | 2 | } |
| 1586 | |
|
| 1587 | |
public void setOriginalModel( Model originalModel ) |
| 1588 | |
{ |
| 1589 | 412 | this.originalModel = originalModel; |
| 1590 | 412 | } |
| 1591 | |
|
| 1592 | |
public Model getOriginalModel() |
| 1593 | |
{ |
| 1594 | 444 | return originalModel; |
| 1595 | |
} |
| 1596 | |
|
| 1597 | |
public void setManagedVersionMap( Map map ) |
| 1598 | |
{ |
| 1599 | 112 | this.managedVersionMap = map; |
| 1600 | 112 | } |
| 1601 | |
|
| 1602 | |
public Map getManagedVersionMap() |
| 1603 | |
{ |
| 1604 | 181 | return this.managedVersionMap; |
| 1605 | |
} |
| 1606 | |
|
| 1607 | |
public boolean equals( Object other ) |
| 1608 | |
{ |
| 1609 | 34 | if ( other == this ) |
| 1610 | |
{ |
| 1611 | 27 | return true; |
| 1612 | |
} |
| 1613 | 7 | else if ( !( other instanceof MavenProject ) ) |
| 1614 | |
{ |
| 1615 | 0 | return false; |
| 1616 | |
} |
| 1617 | |
else |
| 1618 | |
{ |
| 1619 | 7 | MavenProject otherProject = (MavenProject) other; |
| 1620 | |
|
| 1621 | 7 | return getId().equals( otherProject.getId() ); |
| 1622 | |
} |
| 1623 | |
} |
| 1624 | |
|
| 1625 | |
public int hashCode() |
| 1626 | |
{ |
| 1627 | 27 | return getId().hashCode(); |
| 1628 | |
} |
| 1629 | |
|
| 1630 | |
public List getBuildExtensions() |
| 1631 | |
{ |
| 1632 | 144 | Build build = getBuild(); |
| 1633 | 144 | if ( build == null || build.getExtensions() == null ) |
| 1634 | |
{ |
| 1635 | 0 | return Collections.EMPTY_LIST; |
| 1636 | |
} |
| 1637 | |
else |
| 1638 | |
{ |
| 1639 | 144 | return build.getExtensions(); |
| 1640 | |
} |
| 1641 | |
} |
| 1642 | |
|
| 1643 | |
|
| 1644 | |
|
| 1645 | |
|
| 1646 | |
|
| 1647 | |
public Set createArtifacts( ArtifactFactory artifactFactory, String inheritedScope, |
| 1648 | |
ArtifactFilter dependencyFilter ) |
| 1649 | |
throws InvalidDependencyVersionException |
| 1650 | |
{ |
| 1651 | 78 | return MavenMetadataSource.createArtifacts( artifactFactory, getDependencies(), inheritedScope, |
| 1652 | |
dependencyFilter, this ); |
| 1653 | |
} |
| 1654 | |
|
| 1655 | |
public void addProjectReference( MavenProject project ) |
| 1656 | |
{ |
| 1657 | 22 | projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project ); |
| 1658 | 22 | } |
| 1659 | |
|
| 1660 | |
public static String getProjectReferenceId( String groupId, String artifactId, String version ) |
| 1661 | |
{ |
| 1662 | 22 | return groupId + ":" + artifactId + ":" + version; |
| 1663 | |
} |
| 1664 | |
|
| 1665 | |
|
| 1666 | |
|
| 1667 | |
|
| 1668 | |
public void attachArtifact( String type, String classifier, File file ) |
| 1669 | |
{ |
| 1670 | 0 | } |
| 1671 | |
|
| 1672 | |
public Properties getProperties() |
| 1673 | |
{ |
| 1674 | 33 | return getModel().getProperties(); |
| 1675 | |
} |
| 1676 | |
|
| 1677 | |
public List getFilters() |
| 1678 | |
{ |
| 1679 | 0 | return getBuild().getFilters(); |
| 1680 | |
} |
| 1681 | |
|
| 1682 | |
public Map getProjectReferences() |
| 1683 | |
{ |
| 1684 | 181 | return projectReferences; |
| 1685 | |
} |
| 1686 | |
|
| 1687 | |
public boolean isExecutionRoot() |
| 1688 | |
{ |
| 1689 | 182 | return executionRoot; |
| 1690 | |
} |
| 1691 | |
|
| 1692 | |
public void setExecutionRoot( boolean executionRoot ) |
| 1693 | |
{ |
| 1694 | 159 | this.executionRoot = executionRoot; |
| 1695 | 159 | } |
| 1696 | |
|
| 1697 | |
public String getDefaultGoal() |
| 1698 | |
{ |
| 1699 | 0 | return getBuild() != null ? getBuild().getDefaultGoal() : null; |
| 1700 | |
} |
| 1701 | |
|
| 1702 | |
|
| 1703 | |
protected void setModel( Model model ) |
| 1704 | |
{ |
| 1705 | 558 | this.model = model; |
| 1706 | 558 | } |
| 1707 | |
|
| 1708 | |
protected void setAttachedArtifacts( List attachedArtifacts ) |
| 1709 | |
{ |
| 1710 | 147 | this.attachedArtifacts = attachedArtifacts; |
| 1711 | 147 | } |
| 1712 | |
|
| 1713 | |
protected void setCompileSourceRoots( List compileSourceRoots ) |
| 1714 | |
{ |
| 1715 | 170 | this.compileSourceRoots = compileSourceRoots; |
| 1716 | 170 | } |
| 1717 | |
|
| 1718 | |
protected void setTestCompileSourceRoots( List testCompileSourceRoots ) |
| 1719 | |
{ |
| 1720 | 170 | this.testCompileSourceRoots = testCompileSourceRoots; |
| 1721 | 170 | } |
| 1722 | |
|
| 1723 | |
protected void setScriptSourceRoots( List scriptSourceRoots ) |
| 1724 | |
{ |
| 1725 | 170 | this.scriptSourceRoots = scriptSourceRoots; |
| 1726 | 170 | } |
| 1727 | |
|
| 1728 | |
protected ArtifactRepository getReleaseArtifactRepository() |
| 1729 | |
{ |
| 1730 | 148 | return releaseArtifactRepository; |
| 1731 | |
} |
| 1732 | |
|
| 1733 | |
protected ArtifactRepository getSnapshotArtifactRepository() |
| 1734 | |
{ |
| 1735 | 150 | return snapshotArtifactRepository; |
| 1736 | |
} |
| 1737 | |
|
| 1738 | |
public void resolveActiveArtifacts() |
| 1739 | |
{ |
| 1740 | 0 | Set depArtifacts = getDependencyArtifacts(); |
| 1741 | 0 | if ( depArtifacts == null ) |
| 1742 | |
{ |
| 1743 | 0 | return; |
| 1744 | |
} |
| 1745 | |
|
| 1746 | 0 | Set updated = new LinkedHashSet( depArtifacts.size() ); |
| 1747 | 0 | int updatedCount = 0; |
| 1748 | |
|
| 1749 | 0 | for ( Iterator it = depArtifacts.iterator(); it.hasNext(); ) |
| 1750 | |
{ |
| 1751 | 0 | Artifact depArtifact = (Artifact) it.next(); |
| 1752 | 0 | Artifact replaced = replaceWithActiveArtifact( depArtifact ); |
| 1753 | |
|
| 1754 | 0 | if ( depArtifact != replaced ) |
| 1755 | |
{ |
| 1756 | 0 | updatedCount++; |
| 1757 | |
} |
| 1758 | |
|
| 1759 | 0 | updated.add( replaced ); |
| 1760 | 0 | } |
| 1761 | |
|
| 1762 | 0 | if ( updatedCount > 0 ) |
| 1763 | |
{ |
| 1764 | 0 | setDependencyArtifacts( updated ); |
| 1765 | |
} |
| 1766 | 0 | } |
| 1767 | |
|
| 1768 | |
public Artifact replaceWithActiveArtifact( Artifact pluginArtifact ) |
| 1769 | |
{ |
| 1770 | 71 | if ( getProjectReferences() != null && !getProjectReferences().isEmpty() ) |
| 1771 | |
{ |
| 1772 | 0 | String refId = getProjectReferenceId( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() ); |
| 1773 | 0 | MavenProject ref = (MavenProject) getProjectReferences().get( refId ); |
| 1774 | 0 | if ( ref != null ) |
| 1775 | |
{ |
| 1776 | 0 | if ( ref.getArtifact() != null |
| 1777 | |
&& ref.getArtifact().getDependencyConflictId().equals( pluginArtifact.getDependencyConflictId() ) ) |
| 1778 | |
{ |
| 1779 | |
|
| 1780 | 0 | if ( ref.getArtifact().getFile() != null && ref.getArtifact().getFile().exists() ) |
| 1781 | |
{ |
| 1782 | |
|
| 1783 | 0 | Artifact resultArtifact = new ActiveProjectArtifact( ref, pluginArtifact ); |
| 1784 | 0 | return resultArtifact; |
| 1785 | |
} |
| 1786 | |
else |
| 1787 | |
{ |
| 1788 | 0 | logMissingSiblingProjectArtifact( pluginArtifact ); |
| 1789 | |
} |
| 1790 | |
} |
| 1791 | |
|
| 1792 | 0 | Artifact attached = findMatchingArtifact( ref.getAttachedArtifacts(), pluginArtifact ); |
| 1793 | 0 | if ( attached != null ) |
| 1794 | |
{ |
| 1795 | 0 | if ( attached.getFile() != null && attached.getFile().exists() ) |
| 1796 | |
{ |
| 1797 | 0 | Artifact resultArtifact = ArtifactUtils.copyArtifact( attached ); |
| 1798 | 0 | resultArtifact.setScope( pluginArtifact.getScope() ); |
| 1799 | 0 | return resultArtifact; |
| 1800 | |
} |
| 1801 | |
else |
| 1802 | |
{ |
| 1803 | 0 | logMissingSiblingProjectArtifact( pluginArtifact ); |
| 1804 | |
} |
| 1805 | |
} |
| 1806 | |
} |
| 1807 | |
} |
| 1808 | 71 | return pluginArtifact; |
| 1809 | |
} |
| 1810 | |
|
| 1811 | |
|
| 1812 | |
|
| 1813 | |
|
| 1814 | |
|
| 1815 | |
|
| 1816 | |
|
| 1817 | |
|
| 1818 | |
private Artifact findMatchingArtifact( List artifacts, Artifact requestedArtifact ) |
| 1819 | |
{ |
| 1820 | 0 | if ( artifacts != null && !artifacts.isEmpty() ) |
| 1821 | |
{ |
| 1822 | |
|
| 1823 | 0 | String requestedId = requestedArtifact.getDependencyConflictId(); |
| 1824 | 0 | for ( Iterator it = artifacts.iterator(); it.hasNext(); ) |
| 1825 | |
{ |
| 1826 | 0 | Artifact artifact = (Artifact) it.next(); |
| 1827 | 0 | if ( requestedId.equals( artifact.getDependencyConflictId() ) ) |
| 1828 | |
{ |
| 1829 | 0 | return artifact; |
| 1830 | |
} |
| 1831 | 0 | } |
| 1832 | |
|
| 1833 | |
|
| 1834 | 0 | requestedId = getRepositoryConflictId( requestedArtifact ); |
| 1835 | 0 | for ( Iterator it = artifacts.iterator(); it.hasNext(); ) |
| 1836 | |
{ |
| 1837 | 0 | Artifact artifact = (Artifact) it.next(); |
| 1838 | 0 | if ( requestedId.equals( getRepositoryConflictId( artifact ) ) ) |
| 1839 | |
{ |
| 1840 | 0 | return artifact; |
| 1841 | |
} |
| 1842 | 0 | } |
| 1843 | |
} |
| 1844 | |
|
| 1845 | 0 | return null; |
| 1846 | |
} |
| 1847 | |
|
| 1848 | |
|
| 1849 | |
|
| 1850 | |
|
| 1851 | |
|
| 1852 | |
|
| 1853 | |
|
| 1854 | |
|
| 1855 | |
|
| 1856 | |
private String getRepositoryConflictId( Artifact artifact ) |
| 1857 | |
{ |
| 1858 | 0 | StringBuffer buffer = new StringBuffer( 128 ); |
| 1859 | 0 | buffer.append( artifact.getGroupId() ); |
| 1860 | 0 | buffer.append( ':' ).append( artifact.getArtifactId() ); |
| 1861 | 0 | if ( artifact.getArtifactHandler() != null ) |
| 1862 | |
{ |
| 1863 | 0 | buffer.append( ':' ).append( artifact.getArtifactHandler().getExtension() ); |
| 1864 | |
} |
| 1865 | |
else |
| 1866 | |
{ |
| 1867 | 0 | buffer.append( ':' ).append( artifact.getType() ); |
| 1868 | |
} |
| 1869 | 0 | if ( artifact.hasClassifier() ) |
| 1870 | |
{ |
| 1871 | 0 | buffer.append( ':' ).append( artifact.getClassifier() ); |
| 1872 | |
} |
| 1873 | 0 | return buffer.toString(); |
| 1874 | |
} |
| 1875 | |
|
| 1876 | |
private void logMissingSiblingProjectArtifact( Artifact artifact ) |
| 1877 | |
{ |
| 1878 | 0 | if ( logger == null || !logger.isDebugEnabled() ) |
| 1879 | |
{ |
| 1880 | 0 | return; |
| 1881 | |
} |
| 1882 | |
|
| 1883 | 0 | if ( logger.isDebugEnabled() ) |
| 1884 | |
{ |
| 1885 | 0 | StringBuffer message = new StringBuffer(); |
| 1886 | 0 | message.append( "WARNING: A dependency of the current project (or of one the plugins used in its build) was found in the reactor, " ); |
| 1887 | 0 | message.append( "\nbut had not been built at the time it was requested. It will be resolved from the repository instead." ); |
| 1888 | 0 | message.append( "\n\nCurrent Project: " ).append( getName() ); |
| 1889 | 0 | message.append( "\nRequested Dependency: " ).append( artifact.getId() ); |
| 1890 | 0 | message.append( "\n\nNOTE: You may need to run this build to the 'compile' lifecycle phase, or farther, in order to build the dependency artifact." ); |
| 1891 | 0 | message.append( "\n" ); |
| 1892 | |
|
| 1893 | 0 | logger.debug( message.toString() ); |
| 1894 | 0 | } |
| 1895 | |
else |
| 1896 | |
{ |
| 1897 | 0 | logger.warn( "Requested project artifact: " + artifact.getId() + " is not available at this time. Resolving externally." ); |
| 1898 | |
} |
| 1899 | 0 | } |
| 1900 | |
|
| 1901 | |
private void addArtifactPath(Artifact a, List list) throws DependencyResolutionRequiredException |
| 1902 | |
{ |
| 1903 | 0 | File file = a.getFile(); |
| 1904 | 0 | if ( file == null ) |
| 1905 | |
{ |
| 1906 | 0 | throw new DependencyResolutionRequiredException( a ); |
| 1907 | |
} |
| 1908 | 0 | list.add( file.getPath() ); |
| 1909 | 0 | } |
| 1910 | |
|
| 1911 | |
|
| 1912 | |
|
| 1913 | |
|
| 1914 | |
public String toString() |
| 1915 | |
{ |
| 1916 | 24 | StringBuffer sb = new StringBuffer(30); |
| 1917 | 24 | sb.append( "MavenProject: " ); |
| 1918 | 24 | sb.append( this.getGroupId() ); |
| 1919 | 24 | sb.append( ":" ); |
| 1920 | 24 | sb.append( this.getArtifactId() ); |
| 1921 | 24 | sb.append( ":" ); |
| 1922 | 24 | sb.append( this.getVersion() ); |
| 1923 | 24 | sb.append( " @ " ); |
| 1924 | |
|
| 1925 | |
try |
| 1926 | |
{ |
| 1927 | 24 | sb.append( this.getFile().getPath() ); |
| 1928 | |
} |
| 1929 | 18 | catch (NullPointerException e) |
| 1930 | |
{ |
| 1931 | |
|
| 1932 | 6 | } |
| 1933 | |
|
| 1934 | 24 | return sb.toString(); |
| 1935 | |
} |
| 1936 | |
|
| 1937 | |
|
| 1938 | |
|
| 1939 | |
|
| 1940 | |
|
| 1941 | |
public Object clone() |
| 1942 | |
throws CloneNotSupportedException |
| 1943 | |
{ |
| 1944 | 3 | MavenProject clone = (MavenProject) super.clone(); |
| 1945 | 3 | clone.deepCopy( this ); |
| 1946 | 3 | return clone; |
| 1947 | |
} |
| 1948 | |
|
| 1949 | |
|
| 1950 | |
|
| 1951 | |
|
| 1952 | |
|
| 1953 | |
private Build dynamicBuild; |
| 1954 | |
|
| 1955 | |
private Build originalInterpolatedBuild; |
| 1956 | |
|
| 1957 | |
private List dynamicCompileSourceRoots; |
| 1958 | |
|
| 1959 | |
private List originalInterpolatedCompileSourceRoots; |
| 1960 | |
|
| 1961 | |
private List dynamicTestCompileSourceRoots; |
| 1962 | |
|
| 1963 | |
private List originalInterpolatedTestCompileSourceRoots; |
| 1964 | |
|
| 1965 | |
private List dynamicScriptSourceRoots; |
| 1966 | |
|
| 1967 | |
private List originalInterpolatedScriptSourceRoots; |
| 1968 | |
|
| 1969 | 555 | private boolean isConcrete = false; |
| 1970 | |
|
| 1971 | |
public boolean isConcrete() |
| 1972 | |
{ |
| 1973 | 337 | return isConcrete; |
| 1974 | |
} |
| 1975 | |
|
| 1976 | |
public void setConcrete( boolean concrete ) |
| 1977 | |
{ |
| 1978 | 170 | isConcrete = concrete; |
| 1979 | 170 | } |
| 1980 | |
|
| 1981 | |
public Build getDynamicBuild() |
| 1982 | |
{ |
| 1983 | 16 | return dynamicBuild; |
| 1984 | |
} |
| 1985 | |
|
| 1986 | |
public Build getOriginalInterpolatedBuild() |
| 1987 | |
{ |
| 1988 | 11 | return originalInterpolatedBuild; |
| 1989 | |
} |
| 1990 | |
|
| 1991 | |
public List getDynamicCompileSourceRoots() |
| 1992 | |
{ |
| 1993 | 8 | return dynamicCompileSourceRoots; |
| 1994 | |
} |
| 1995 | |
|
| 1996 | |
public List getOriginalInterpolatedCompileSourceRoots() |
| 1997 | |
{ |
| 1998 | 8 | return originalInterpolatedCompileSourceRoots; |
| 1999 | |
} |
| 2000 | |
|
| 2001 | |
public List getDynamicTestCompileSourceRoots() |
| 2002 | |
{ |
| 2003 | 8 | return dynamicTestCompileSourceRoots; |
| 2004 | |
} |
| 2005 | |
|
| 2006 | |
public List getOriginalInterpolatedTestCompileSourceRoots() |
| 2007 | |
{ |
| 2008 | 8 | return originalInterpolatedTestCompileSourceRoots; |
| 2009 | |
} |
| 2010 | |
|
| 2011 | |
public List getDynamicScriptSourceRoots() |
| 2012 | |
{ |
| 2013 | 8 | return dynamicScriptSourceRoots; |
| 2014 | |
} |
| 2015 | |
|
| 2016 | |
public List getOriginalInterpolatedScriptSourceRoots() |
| 2017 | |
{ |
| 2018 | 8 | return originalInterpolatedScriptSourceRoots; |
| 2019 | |
} |
| 2020 | |
|
| 2021 | |
public void clearRestorableRoots() |
| 2022 | |
{ |
| 2023 | 8 | dynamicCompileSourceRoots = null; |
| 2024 | 8 | dynamicTestCompileSourceRoots = null; |
| 2025 | 8 | dynamicScriptSourceRoots = null; |
| 2026 | 8 | originalInterpolatedCompileSourceRoots = null; |
| 2027 | 8 | originalInterpolatedScriptSourceRoots = null; |
| 2028 | 8 | originalInterpolatedTestCompileSourceRoots = null; |
| 2029 | 8 | } |
| 2030 | |
|
| 2031 | |
public void clearRestorableBuild() |
| 2032 | |
{ |
| 2033 | 8 | dynamicBuild = null; |
| 2034 | 8 | originalInterpolatedBuild = null; |
| 2035 | 8 | } |
| 2036 | |
|
| 2037 | |
public void preserveCompileSourceRoots( List originalInterpolatedCompileSourceRoots ) |
| 2038 | |
{ |
| 2039 | 15 | dynamicCompileSourceRoots = getCompileSourceRoots(); |
| 2040 | 15 | this.originalInterpolatedCompileSourceRoots = originalInterpolatedCompileSourceRoots; |
| 2041 | 15 | } |
| 2042 | |
|
| 2043 | |
public void preserveTestCompileSourceRoots( List originalInterpolatedTestCompileSourceRoots ) |
| 2044 | |
{ |
| 2045 | 15 | dynamicTestCompileSourceRoots = getTestCompileSourceRoots(); |
| 2046 | 15 | this.originalInterpolatedTestCompileSourceRoots = originalInterpolatedTestCompileSourceRoots; |
| 2047 | 15 | } |
| 2048 | |
|
| 2049 | |
public void preserveScriptSourceRoots( List originalInterpolatedScriptSourceRoots ) |
| 2050 | |
{ |
| 2051 | 15 | dynamicScriptSourceRoots = getScriptSourceRoots(); |
| 2052 | 15 | this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots; |
| 2053 | 15 | } |
| 2054 | |
|
| 2055 | |
public void preserveBuild( Build originalInterpolatedBuild ) |
| 2056 | |
{ |
| 2057 | 15 | dynamicBuild = getBuild(); |
| 2058 | 15 | this.originalInterpolatedBuild = originalInterpolatedBuild; |
| 2059 | |
|
| 2060 | 15 | this.originalInterpolatedBuild.setPluginManagement( null ); |
| 2061 | 15 | this.originalInterpolatedBuild.setPlugins( null ); |
| 2062 | 15 | } |
| 2063 | |
|
| 2064 | |
protected void setDynamicBuild( Build dynamicBuild ) |
| 2065 | |
{ |
| 2066 | 0 | this.dynamicBuild = dynamicBuild; |
| 2067 | 0 | } |
| 2068 | |
|
| 2069 | |
protected void setOriginalInterpolatedBuild( Build originalInterpolatedBuild ) |
| 2070 | |
{ |
| 2071 | 0 | this.originalInterpolatedBuild = originalInterpolatedBuild; |
| 2072 | 0 | } |
| 2073 | |
|
| 2074 | |
protected void setDynamicCompileSourceRoots( List dynamicCompileSourceRoots ) |
| 2075 | |
{ |
| 2076 | 0 | this.dynamicCompileSourceRoots = dynamicCompileSourceRoots; |
| 2077 | 0 | } |
| 2078 | |
|
| 2079 | |
protected void setOriginalInterpolatedCompileSourceRoots( List originalInterpolatedCompileSourceRoots ) |
| 2080 | |
{ |
| 2081 | 0 | this.originalInterpolatedCompileSourceRoots = originalInterpolatedCompileSourceRoots; |
| 2082 | 0 | } |
| 2083 | |
|
| 2084 | |
protected void setDynamicTestCompileSourceRoots( List dynamicTestCompileSourceRoots ) |
| 2085 | |
{ |
| 2086 | 0 | this.dynamicTestCompileSourceRoots = dynamicTestCompileSourceRoots; |
| 2087 | 0 | } |
| 2088 | |
|
| 2089 | |
protected void setOriginalInterpolatedTestCompileSourceRoots( List originalInterpolatedTestCompileSourceRoots ) |
| 2090 | |
{ |
| 2091 | 0 | this.originalInterpolatedTestCompileSourceRoots = originalInterpolatedTestCompileSourceRoots; |
| 2092 | 0 | } |
| 2093 | |
|
| 2094 | |
protected void setDynamicScriptSourceRoots( List dynamicScriptSourceRoots ) |
| 2095 | |
{ |
| 2096 | 0 | this.dynamicScriptSourceRoots = dynamicScriptSourceRoots; |
| 2097 | 0 | } |
| 2098 | |
|
| 2099 | |
protected void setOriginalInterpolatedScriptSourceRoots( List originalInterpolatedScriptSourceRoots ) |
| 2100 | |
{ |
| 2101 | 0 | this.originalInterpolatedScriptSourceRoots = originalInterpolatedScriptSourceRoots; |
| 2102 | 0 | } |
| 2103 | |
|
| 2104 | |
private Properties preservedProperties; |
| 2105 | |
|
| 2106 | |
public Properties getPreservedProperties() |
| 2107 | |
{ |
| 2108 | 9 | return preservedProperties; |
| 2109 | |
} |
| 2110 | |
|
| 2111 | |
public void preserveProperties() |
| 2112 | |
{ |
| 2113 | 15 | Properties p = getProperties(); |
| 2114 | 15 | if ( p != null ) |
| 2115 | |
{ |
| 2116 | 15 | preservedProperties = new Properties(); |
| 2117 | 15 | for( Enumeration e = p.propertyNames(); e.hasMoreElements(); ) |
| 2118 | |
{ |
| 2119 | 12 | String key = (String) e.nextElement(); |
| 2120 | 12 | preservedProperties.setProperty( key, p.getProperty( key ) ); |
| 2121 | 12 | } |
| 2122 | |
} |
| 2123 | 15 | } |
| 2124 | |
|
| 2125 | |
private File preservedBasedir; |
| 2126 | |
|
| 2127 | |
public File getPreservedBasedir() |
| 2128 | |
{ |
| 2129 | 9 | return preservedBasedir; |
| 2130 | |
} |
| 2131 | |
|
| 2132 | |
public void preserveBasedir() |
| 2133 | |
{ |
| 2134 | 15 | this.preservedBasedir = getBasedir(); |
| 2135 | 15 | } |
| 2136 | |
|
| 2137 | |
public void setLogger( Logger logger ) |
| 2138 | |
{ |
| 2139 | 253 | this.logger = logger; |
| 2140 | 253 | } |
| 2141 | |
|
| 2142 | |
|
| 2143 | |
|
| 2144 | |
|
| 2145 | |
public ProjectBuilderConfiguration getProjectBuilderConfiguration() |
| 2146 | |
{ |
| 2147 | 0 | return projectBuilderConfiguration; |
| 2148 | |
} |
| 2149 | |
|
| 2150 | |
|
| 2151 | |
|
| 2152 | |
|
| 2153 | |
|
| 2154 | |
public void setProjectBuilderConfiguration( ProjectBuilderConfiguration projectBuilderConfiguration ) |
| 2155 | |
{ |
| 2156 | 109 | this.projectBuilderConfiguration = projectBuilderConfiguration; |
| 2157 | 109 | } |
| 2158 | |
|
| 2159 | |
} |