View Javadoc

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