1 package org.apache.maven.plugin.assembly.artifact;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.Iterator;
26 import java.util.List;
27 import java.util.Set;
28
29 import org.apache.maven.artifact.Artifact;
30 import org.apache.maven.artifact.factory.ArtifactFactory;
31 import org.apache.maven.artifact.metadata.ArtifactMetadataSource;
32 import org.apache.maven.artifact.repository.ArtifactRepository;
33 import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
34 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
35 import org.apache.maven.artifact.resolver.ArtifactCollector;
36 import org.apache.maven.artifact.resolver.ArtifactResolver;
37 import org.apache.maven.model.Model;
38 import org.apache.maven.plugin.assembly.AssemblerConfigurationSource;
39 import org.apache.maven.plugin.assembly.model.Assembly;
40 import org.apache.maven.plugin.assembly.model.DependencySet;
41 import org.apache.maven.plugin.assembly.model.ModuleBinaries;
42 import org.apache.maven.plugin.assembly.model.ModuleSet;
43 import org.apache.maven.plugin.assembly.model.Repository;
44 import org.apache.maven.plugin.assembly.testutils.MockManager;
45 import org.apache.maven.project.MavenProject;
46 import org.codehaus.plexus.PlexusTestCase;
47 import org.codehaus.plexus.logging.Logger;
48 import org.codehaus.plexus.logging.console.ConsoleLogger;
49 import org.easymock.MockControl;
50
51 public class DefaultDependencyResolverTest
52 extends PlexusTestCase
53 {
54
55 private ArtifactFactory factory;
56
57 private ArtifactRepositoryFactory repoFactory;
58
59 private ArtifactRepositoryLayout layout;
60
61 private ArtifactResolver resolver;
62
63 private ArtifactMetadataSource metadataSource;
64
65 private ArtifactCollector collector;
66
67 private ConsoleLogger logger;
68
69 @Override
70 public void setUp()
71 throws Exception
72 {
73 super.setUp();
74
75 resolver = (ArtifactResolver) lookup( ArtifactResolver.ROLE );
76 metadataSource = (ArtifactMetadataSource) lookup( ArtifactMetadataSource.ROLE );
77 factory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
78 repoFactory = (ArtifactRepositoryFactory) lookup( ArtifactRepositoryFactory.ROLE );
79 layout = (ArtifactRepositoryLayout) lookup( ArtifactRepositoryLayout.ROLE, "default" );
80 collector = (ArtifactCollector) lookup( ArtifactCollector.class.getName() );
81 logger = new ConsoleLogger( Logger.LEVEL_DEBUG, "test" );
82 }
83
84 public void test_getDependencySetResolutionRequirements()
85 throws DependencyResolutionException
86 {
87 final List<DependencySet> depSets = new ArrayList<DependencySet>();
88
89 final DependencySet ds1 = new DependencySet();
90 ds1.setScope( Artifact.SCOPE_COMPILE );
91 ds1.setUseTransitiveDependencies( false );
92
93 depSets.add( ds1 );
94
95 final DependencySet ds2 = new DependencySet();
96 ds2.setScope( Artifact.SCOPE_SYSTEM );
97 ds2.setUseTransitiveDependencies( false );
98
99 depSets.add( ds2 );
100
101 final MavenProject project = createMavenProject( "main-group", "main-artifact", "1", null );
102
103 final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
104
105 new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getDependencySetResolutionRequirements( new Assembly(),
106 depSets,
107 info,
108 project );
109
110 assertTrue( info.isResolutionRequired() );
111 assertFalse( info.isResolvedTransitively() );
112
113 assertTrue( info.getScopeFilter().isIncludeCompileScope() );
114 assertTrue( info.getScopeFilter().isIncludeSystemScope() );
115
116 assertTrue( info.getScopeFilter().isIncludeProvidedScope() );
117
118 assertFalse( info.getScopeFilter().isIncludeRuntimeScope() );
119 assertFalse( info.getScopeFilter().isIncludeTestScope() );
120 }
121
122 public void test_getModuleSetResolutionRequirements()
123 throws DependencyResolutionException
124 {
125 final MockManager mm = new MockManager();
126
127 final MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
128 mm.add( csControl );
129
130 final AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
131
132 final File rootDir = new File( "root" );
133 final MavenProject project = createMavenProject( "main-group", "main-artifact", "1", rootDir );
134
135 final File module1Dir = new File( rootDir, "module-1" );
136 final MavenProject module1 = createMavenProject( "main-group", "module-1", "1", module1Dir );
137 final MavenProject module1a =
138 createMavenProject( "group1", "module-1a", "1", new File( module1Dir, "module-1a" ) );
139 final MavenProject module1b =
140 createMavenProject( "group1.b", "module-1b", "1", new File( module1Dir, "module-1b" ) );
141
142 module1.getModel().addModule( module1a.getArtifactId() );
143 module1.getModel().addModule( module1b.getArtifactId() );
144
145 final File module2Dir = new File( rootDir, "module-2" );
146 final MavenProject module2 = createMavenProject( "main-group", "module-2", "1", module2Dir );
147 final MavenProject module2a =
148 createMavenProject( "main-group", "module-2a", "1", new File( module2Dir, "module-2a" ) );
149
150 module2.getModel().addModule( module2a.getArtifactId() );
151
152 project.getModel().addModule( module1.getArtifactId() );
153 project.getModel().addModule( module2.getArtifactId() );
154
155 final List<MavenProject> allProjects = new ArrayList<MavenProject>();
156 allProjects.add( project );
157 allProjects.add( module1 );
158 allProjects.add( module1a );
159 allProjects.add( module1b );
160 allProjects.add( module2 );
161 allProjects.add( module2a );
162
163 cs.getReactorProjects();
164 csControl.setReturnValue( allProjects, MockControl.ZERO_OR_MORE );
165
166 cs.getProject();
167 csControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
168
169 final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
170
171 final List<ModuleSet> moduleSets = new ArrayList<ModuleSet>();
172
173 {
174 final ModuleSet ms = new ModuleSet();
175 ms.addInclude( "*module1*" );
176 ms.setIncludeSubModules( false );
177
178 final ModuleBinaries mb = new ModuleBinaries();
179
180 final DependencySet ds = new DependencySet();
181 ds.setScope( Artifact.SCOPE_COMPILE );
182
183 mb.addDependencySet( ds );
184 ms.setBinaries( mb );
185 moduleSets.add( ms );
186 }
187
188 {
189 final ModuleSet ms = new ModuleSet();
190 ms.addInclude( "main-group:*" );
191 ms.setIncludeSubModules( true );
192
193 final ModuleBinaries mb = new ModuleBinaries();
194
195 final DependencySet ds = new DependencySet();
196 ds.setScope( Artifact.SCOPE_TEST );
197
198 mb.addDependencySet( ds );
199 ms.setBinaries( mb );
200 moduleSets.add( ms );
201 }
202
203 mm.replayAll();
204
205 final DefaultDependencyResolver resolver =
206 new DefaultDependencyResolver( this.resolver, metadataSource, factory, collector, logger );
207 resolver.enableLogging( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
208
209 final Assembly assembly = new Assembly();
210 assembly.setModuleSets( moduleSets );
211
212 resolver.getModuleSetResolutionRequirements( assembly, info, cs );
213
214 assertTrue( info.isResolutionRequired() );
215
216 final Set<MavenProject> enabledProjects = info.getEnabledProjects();
217 assertTrue( enabledProjects.contains( project ) );
218
219 assertTrue( enabledProjects.contains( module1 ) );
220
221 // these should be excluded since sub-modules are not traversable
222 assertFalse( enabledProjects.contains( module1a ) );
223 assertFalse( enabledProjects.contains( module1b ) );
224
225 assertTrue( enabledProjects.contains( module2 ) );
226 assertTrue( enabledProjects.contains( module2a ) );
227
228 // these are the two we directly set above.
229 assertTrue( info.getScopeFilter().isIncludeTestScope() );
230 assertTrue( info.getScopeFilter().isIncludeCompileScope() );
231
232 // this combination should be implied by the two direct scopes set above.
233 assertTrue( info.getScopeFilter().isIncludeRuntimeScope() );
234 assertTrue( info.getScopeFilter().isIncludeProvidedScope() );
235 assertTrue( info.getScopeFilter().isIncludeSystemScope() );
236
237 mm.verifyAll();
238 }
239
240 public void test_getRepositoryResolutionRequirements()
241 {
242 final List<Repository> repositories = new ArrayList<Repository>();
243
244 {
245 final Repository r = new Repository();
246 r.setScope( Artifact.SCOPE_COMPILE );
247 repositories.add( r );
248 }
249
250 {
251 final Repository r = new Repository();
252 r.setScope( Artifact.SCOPE_SYSTEM );
253 repositories.add( r );
254 }
255
256 final MavenProject project = createMavenProject( "group", "artifact", "1.0", null );
257 final Assembly assembly = new Assembly();
258 assembly.setRepositories( repositories );
259
260 final ResolutionManagementInfo info = new ResolutionManagementInfo( project );
261 new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).getRepositoryResolutionRequirements( assembly,
262 info,
263 project );
264
265 assertTrue( info.isResolutionRequired() );
266
267 assertTrue( info.getScopeFilter().isIncludeCompileScope() );
268 assertTrue( info.getScopeFilter().isIncludeSystemScope() );
269
270 assertTrue( info.getScopeFilter().isIncludeProvidedScope() );
271
272 assertFalse( info.getScopeFilter().isIncludeRuntimeScope() );
273 assertFalse( info.getScopeFilter().isIncludeTestScope() );
274 }
275
276 public void test_aggregateRemoteArtifactRepositories()
277 {
278 final List<ArtifactRepository> externalRepos = new ArrayList<ArtifactRepository>();
279
280 final ArtifactRepository er1 =
281 repoFactory.createArtifactRepository( "test.1", "http://test.com/path", layout, null, null );
282 externalRepos.add( er1 );
283
284 final ArtifactRepository er2 =
285 repoFactory.createArtifactRepository( "test.2", "http://test2.com/path", layout, null, null );
286 externalRepos.add( er2 );
287
288 final List<ArtifactRepository> projectRepos = new ArrayList<ArtifactRepository>();
289
290 final ArtifactRepository pr1 =
291 repoFactory.createArtifactRepository( "project.1", "http://test.com/project", layout, null, null );
292 projectRepos.add( pr1 );
293
294 final ArtifactRepository pr2 =
295 repoFactory.createArtifactRepository( "project.2", "http://test2.com/path", layout, null, null );
296 projectRepos.add( pr2 );
297
298 final MavenProject project = createMavenProject( "group", "artifact", "1", new File( "base" ) );
299 project.setRemoteArtifactRepositories( projectRepos );
300
301 final List<ArtifactRepository> aggregated =
302 new DefaultDependencyResolver( resolver, metadataSource, factory, collector, logger ).aggregateRemoteArtifactRepositories( externalRepos,
303 Collections.singleton( project ) );
304
305 assertRepositoryWithId( er1.getId(), aggregated, true );
306 assertRepositoryWithId( er2.getId(), aggregated, true );
307 assertRepositoryWithId( pr1.getId(), aggregated, true );
308 assertRepositoryWithId( pr2.getId(), aggregated, false );
309 }
310
311 // public void test_manageArtifact()
312 // {
313 // Artifact managed = factory.createArtifact( "group", "artifact", "1", Artifact.SCOPE_PROVIDED, "jar" );
314 //
315 // Artifact target =
316 // factory.createArtifact( managed.getGroupId(), managed.getArtifactId(), "2", Artifact.SCOPE_COMPILE,
317 // managed.getType() );
318 //
319 // Artifact target2 =
320 // factory.createArtifact( "other-group", managed.getArtifactId(), "2", Artifact.SCOPE_COMPILE,
321 // managed.getType() );
322 //
323 // Map managedVersions = Collections.singletonMap( managed.getDependencyConflictId(), managed );
324 //
325 // DefaultDependencyResolver resolver =
326 // new DefaultDependencyResolver().setLogger( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
327 //
328 // resolver.manageArtifact( target, managedVersions );
329 // resolver.manageArtifact( target2, managedVersions );
330 //
331 // assertEquals( managed.getVersion(), target.getVersion() );
332 // assertEquals( managed.getScope(), target.getScope() );
333 //
334 // assertEquals( "2", target2.getVersion() );
335 // assertEquals( Artifact.SCOPE_COMPILE, target2.getScope() );
336 // }
337
338 // public void test_buildManagedVersionMap_NonTransitiveResolution()
339 // throws ArtifactResolutionException, ArchiveCreationException, InvalidVersionSpecificationException,
340 // InvalidDependencyVersionException
341 // {
342 // Assembly assembly = new Assembly();
343 //
344 // DependencySet ds = new DependencySet();
345 // ds.setScope( Artifact.SCOPE_PROVIDED );
346 // ds.setUseTransitiveDependencies( false );
347 //
348 // assembly.addDependencySet( ds );
349 //
350 // ModuleSet ms = new ModuleSet();
351 // ModuleBinaries mb = new ModuleBinaries();
352 // ms.setBinaries( mb );
353 //
354 // DependencySet mds = new DependencySet();
355 // mds.setScope( Artifact.SCOPE_PROVIDED );
356 // mds.setUseTransitiveDependencies( false );
357 //
358 // mb.addDependencySet( mds );
359 //
360 // assembly.addModuleSet( ms );
361 //
362 // MavenProject project = createMavenProject( "group", "artifact", "1", new File( "base" ) );
363 //
364 // Dependency d1 = new Dependency();
365 // d1.setGroupId( "group.dep" );
366 // d1.setArtifactId( "dep1" );
367 // d1.setVersion( "1" );
368 // d1.setScope( Artifact.SCOPE_COMPILE );
369 //
370 // project.getModel().addDependency( d1 );
371 //
372 // Dependency d2 = new Dependency();
373 // d2.setGroupId( "group.dep" );
374 // d2.setArtifactId( "dep2" );
375 // d2.setVersion( "1" );
376 // d2.setScope( Artifact.SCOPE_PROVIDED );
377 //
378 // project.getModel().addDependency( d2 );
379 //
380 // Dependency d3 = new Dependency();
381 // d3.setGroupId( "group.dep" );
382 // d3.setArtifactId( "dep3" );
383 // d3.setVersion( "1" );
384 // d3.setScope( Artifact.SCOPE_PROVIDED );
385 //
386 // project.getModel().addDependency( d3 );
387 //
388 // MavenProject module = createMavenProject( "group", "module", "1", new File( "base/module" ) );
389 //
390 // project.getModel().addModule( module.getArtifactId() );
391 //
392 // Dependency md = new Dependency();
393 // md.setGroupId( "group.dep" );
394 // md.setArtifactId( "dep3" );
395 // md.setVersion( "2" );
396 // md.setScope( Artifact.SCOPE_PROVIDED );
397 //
398 // module.getModel().addDependency( md );
399 //
400 // List allProjects = new ArrayList();
401 // allProjects.add( project );
402 // allProjects.add( module );
403 //
404 // MockManager mm = new MockManager();
405 //
406 // MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
407 // mm.add( csControl );
408 //
409 // AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
410 //
411 // cs.getProject();
412 // csControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
413 //
414 // cs.getReactorProjects();
415 // csControl.setReturnValue( allProjects, MockControl.ZERO_OR_MORE );
416 //
417 // cs.getRemoteRepositories();
418 // csControl.setReturnValue( Collections.EMPTY_LIST, MockControl.ZERO_OR_MORE );
419 //
420 // mm.replayAll();
421 //
422 // DefaultDependencyResolver resolver = new DefaultDependencyResolver();
423 // resolver.setArtifactFactory( factory );
424 // resolver.setLogger( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
425 //
426 // Map managedVersionMap = resolver.buildManagedVersionMap( assembly, cs );
427 //
428 // {
429 // Dependency d = d1;
430 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
431 // assertNull( a );
432 // }
433 //
434 // {
435 // Dependency d = d2;
436 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
437 // assertNotNull( a );
438 // assertEquals( d.getVersion(), a.getVersion() );
439 // assertEquals( d.getScope(), a.getScope() );
440 // }
441 //
442 // {
443 // Dependency d = d3;
444 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
445 // assertNotNull( a );
446 // assertEquals( d.getVersion(), a.getVersion() );
447 // assertEquals( d.getScope(), a.getScope() );
448 // }
449 //
450 // mm.verifyAll();
451 // }
452 //
453 // public void test_buildManagedVersionMap_TransitiveResolution()
454 // throws ArtifactResolutionException, ArchiveCreationException, InvalidVersionSpecificationException,
455 // InvalidDependencyVersionException
456 // {
457 // Assembly assembly = new Assembly();
458 //
459 // DependencySet ds = new DependencySet();
460 // ds.setScope( Artifact.SCOPE_COMPILE );
461 // ds.setUseTransitiveDependencies( true );
462 //
463 // assembly.addDependencySet( ds );
464 //
465 // MavenProject project = createMavenProject( "group", "artifact", "1", new File( "base" ) );
466 //
467 // Dependency d1 = new Dependency();
468 // d1.setGroupId( "group.dep" );
469 // d1.setArtifactId( "dep1" );
470 // d1.setVersion( "1" );
471 // d1.setScope( Artifact.SCOPE_COMPILE );
472 //
473 // project.getModel().addDependency( d1 );
474 //
475 // Dependency d2 = new Dependency();
476 // d2.setGroupId( "group.dep" );
477 // d2.setArtifactId( "dep2" );
478 // d2.setVersion( "1" );
479 // d2.setScope( Artifact.SCOPE_COMPILE );
480 // final Artifact a2 = factory.createArtifact( d2.getGroupId(), d2.getArtifactId(), d2.getVersion(), d2.getScope(),
481 // "jar" );
482 //
483 // project.getModel().addDependency( d2 );
484 //
485 // Dependency d3 = new Dependency();
486 // d3.setGroupId( "group.dep" );
487 // d3.setArtifactId( "dep3" );
488 // d3.setVersion( "1" );
489 // d3.setScope( Artifact.SCOPE_COMPILE );
490 //
491 // project.getModel().addDependency( d3 );
492 //
493 // final Artifact a2a = factory.createArtifact( d3.getGroupId(), d3.getArtifactId(), "2", Artifact.SCOPE_RUNTIME,
494 // "jar" );
495 //
496 // MockManager mm = new MockManager();
497 //
498 // MockControl msControl = MockControl.createControl( ArtifactMetadataSource.class );
499 // mm.add( msControl );
500 //
501 // ArtifactMetadataSource ms = (ArtifactMetadataSource) msControl.getMock();
502 //
503 // try
504 // {
505 // ms.retrieve( null, null, null );
506 // }
507 // catch ( ArtifactMetadataRetrievalException e )
508 // {
509 // }
510 //
511 // msControl.setDefaultReturnValue( new ResolutionGroup( null, Collections.EMPTY_SET, Collections.EMPTY_LIST ) );
512 // msControl.setMatcher( new ArgumentsMatcher()
513 // {
514 // public boolean matches( Object[] expected, Object[] actual )
515 // {
516 // Artifact a = (Artifact) actual[0];
517 //
518 // return a2.getArtifactId().equals( a.getArtifactId() );
519 // }
520 //
521 // public String toString( Object[] args )
522 // {
523 // return "with artifact: " + args[0] ;
524 // }
525 //
526 // } );
527 // msControl.setReturnValue( new ResolutionGroup( a2, Collections.singleton( a2a ), Collections.EMPTY_LIST ) );
528 //
529 //
530 // MockControl csControl = MockControl.createControl( AssemblerConfigurationSource.class );
531 // mm.add( csControl );
532 //
533 // AssemblerConfigurationSource cs = (AssemblerConfigurationSource) csControl.getMock();
534 //
535 // cs.getProject();
536 // csControl.setReturnValue( project, MockControl.ZERO_OR_MORE );
537 //
538 // String tmpDir = System.getProperty( "java.io.tmpdir" );
539 // ArtifactRepository lr = repoFactory.createArtifactRepository( "local", "file://" + tmpDir, layout, null, null );
540 //
541 // cs.getLocalRepository();
542 // csControl.setReturnValue( lr, MockControl.ZERO_OR_MORE );
543 //
544 // cs.getRemoteRepositories();
545 // csControl.setReturnValue( Collections.EMPTY_LIST, MockControl.ZERO_OR_MORE );
546 //
547 // mm.replayAll();
548 //
549 // DefaultDependencyResolver resolver = new DefaultDependencyResolver();
550 // resolver.setArtifactMetadataSource( ms );
551 // resolver.setArtifactCollector( collector );
552 // resolver.setArtifactFactory( factory );
553 // resolver.setLogger( new ConsoleLogger( Logger.LEVEL_DEBUG, "test" ) );
554 //
555 // Map managedVersionMap = resolver.buildManagedVersionMap( assembly, cs );
556 //
557 // {
558 // Dependency d = d1;
559 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
560 // assertNotNull( a );
561 // assertEquals( d.getVersion(), a.getVersion() );
562 // assertEquals( d.getScope(), a.getScope() );
563 // }
564 //
565 // {
566 // Dependency d = d2;
567 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
568 // assertNotNull( a );
569 // assertEquals( d.getVersion(), a.getVersion() );
570 // assertEquals( d.getScope(), a.getScope() );
571 // }
572 //
573 // {
574 // Dependency d = d3;
575 // Artifact a = (Artifact) managedVersionMap.get( d.getManagementKey() );
576 // assertNotNull( a );
577 // assertEquals( d.getVersion(), a.getVersion() );
578 // assertEquals( d.getScope(), a.getScope() );
579 // }
580 //
581 // mm.verifyAll();
582 // }
583
584 private void assertRepositoryWithId( final String repoId, final List<ArtifactRepository> repos,
585 final boolean shouldExist )
586 {
587 if ( ( repos == null || repos.isEmpty() ) )
588 {
589 if ( shouldExist )
590 {
591 fail( "Repository with id: " + repoId + " should be present, but repository list is null or empty." );
592 }
593 }
594 else
595 {
596 boolean found = false;
597 for ( final Iterator<ArtifactRepository> it = repos.iterator(); it.hasNext(); )
598 {
599 final ArtifactRepository repo = it.next();
600 if ( repoId.equals( repo.getId() ) )
601 {
602 found = true;
603 break;
604 }
605 }
606
607 if ( shouldExist )
608 {
609 assertTrue( "Repository with id: " + repoId + " should be present in repository list.", found );
610 }
611 else
612 {
613 assertFalse( "Repository with id: " + repoId + " should NOT be present in repository list.", found );
614 }
615 }
616 }
617
618 private MavenProject createMavenProject( final String groupId, final String artifactId, final String version,
619 final File basedir )
620 {
621 final Model model = new Model();
622
623 model.setGroupId( groupId );
624 model.setArtifactId( artifactId );
625 model.setVersion( version );
626 model.setPackaging( "pom" );
627
628 final MavenProject project = new MavenProject( model );
629
630 final Artifact pomArtifact = factory.createProjectArtifact( groupId, artifactId, version );
631 project.setArtifact( pomArtifact );
632
633 project.setFile( new File( basedir, "pom.xml" ) );
634
635 return project;
636 }
637
638 }