3535import org .fedoraproject .mbi .Reactor ;
3636import org .fedoraproject .mbi .dist .DistRequest ;
3737import org .fedoraproject .mbi .model .ModuleDescriptor ;
38- import org .fedoraproject .xmvn .artifact .DefaultArtifact ;
3938import org .fedoraproject .xmvn .config .Artifact ;
4039import org .fedoraproject .xmvn .config .Configurator ;
4140import org .fedoraproject .xmvn .config .PackagingRule ;
4241import org .fedoraproject .xmvn .config .Repository ;
43- import org .fedoraproject .xmvn .deployer .Deployer ;
44- import org .fedoraproject .xmvn .deployer .DeploymentRequest ;
4542import org .fedoraproject .xmvn .locator .ServiceLocator ;
4643import org .fedoraproject .xmvn .locator .ServiceLocatorFactory ;
44+ import org .fedoraproject .xmvn .metadata .ArtifactMetadata ;
45+ import org .fedoraproject .xmvn .metadata .Dependency ;
46+ import org .fedoraproject .xmvn .metadata .PackageMetadata ;
4747import org .fedoraproject .xmvn .resolver .Resolver ;
4848import org .fedoraproject .xmvn .tools .install .InstallationRequest ;
4949import org .fedoraproject .xmvn .tools .install .Installer ;
@@ -156,25 +156,21 @@ class Director
156156
157157 private final Path workDir ;
158158
159- private final Path planPath ;
160-
161159 private final Configurator configurator ;
162160
163- private final Deployer deployer ;
164-
165161 private final Installer installer ;
166162
163+ private final PackageMetadata packageMetadata = new PackageMetadata ();
164+
167165 public Director ( DistRequest dist )
168166 {
169167 this .reactor = dist .getReactor ();
170168 this .dist = dist ;
171169 this .workDir = dist .getWorkDir ();
172- planPath = workDir .resolve ( "plan.xml" );
173170
174171 ServiceLocator locator = new ServiceLocatorFactory ().createServiceLocator ();
175172 configurator = locator .getService ( Configurator .class );
176173 Resolver resolver = locator .getService ( Resolver .class );
177- deployer = locator .getService ( Deployer .class );
178174 installer = new DefaultInstaller ( configurator , resolver );
179175 }
180176
@@ -205,7 +201,11 @@ public void deploy( ModuleDescriptor module, String gid, String aid, UArt art )
205201 Files .createDirectories ( artifactsDir );
206202 String version = reactor .getProject ( module .getProjectName () ).getMBIVersion ();
207203
208- DeploymentRequest pomRequest = new DeploymentRequest ();
204+ ArtifactMetadata pom = new ArtifactMetadata ();
205+ pom .setGroupId ( gid );
206+ pom .setArtifactId ( aid );
207+ pom .setExtension ( "pom" );
208+ pom .setVersion ( version );
209209
210210 if ( art != null )
211211 {
@@ -228,22 +228,24 @@ public void deploy( ModuleDescriptor module, String gid, String aid, UArt art )
228228 {
229229 throw new Exception ( "jar tool failed with exit code " + ret );
230230 }
231- DeploymentRequest jarRequest = new DeploymentRequest ();
232- jarRequest .setPlanPath ( planPath );
233- jarRequest .setArtifact ( new DefaultArtifact ( gid , aid , version ).setPath ( jarPath ) );
234- Exception exception = deployer .deploy ( jarRequest ).getException ();
235- if ( exception != null )
236- {
237- throw exception ;
238- }
231+ ArtifactMetadata jar = new ArtifactMetadata ();
232+ jar .setGroupId ( gid );
233+ jar .setArtifactId ( aid );
234+ jar .setVersion ( version );
235+ jar .setPath ( jarPath .toString () );
236+ packageMetadata .addArtifact ( jar );
239237 for ( var dep : art .deps )
240238 {
241- pomRequest .addDependency ( new DefaultArtifact ( dep .gid , dep .aid , dep .ver ) );
239+ Dependency dependency = new Dependency ();
240+ dependency .setGroupId ( dep .gid );
241+ dependency .setArtifactId ( dep .aid );
242+ dependency .setRequestedVersion ( dep .ver );
243+ pom .addDependency ( dependency );
242244 }
243245 }
244246 else
245247 {
246- pomRequest .addProperty ( "type" , "pom" );
248+ pom .addProperty ( "type" , "pom" );
247249 }
248250
249251 Path pomPath = reactor .getPomPath ( module );
@@ -255,13 +257,8 @@ public void deploy( ModuleDescriptor module, String gid, String aid, UArt art )
255257 writer .write ( "Dummy POM file for " + module .getName () + " module" );
256258 }
257259 }
258- pomRequest .setPlanPath ( planPath );
259- pomRequest .setArtifact ( new DefaultArtifact ( gid , aid , "pom" , version ).setPath ( pomPath ) );
260- Exception exception = deployer .deploy ( pomRequest ).getException ();
261- if ( exception != null )
262- {
263- throw exception ;
264- }
260+ pom .setPath ( pomPath .toString () );
261+ packageMetadata .addArtifact ( pom );
265262
266263 if ( art != null )
267264 {
@@ -287,6 +284,9 @@ public void deploy( ModuleDescriptor module, String gid, String aid, UArt art )
287284 public void install ()
288285 throws Exception
289286 {
287+ Path planPath = workDir .resolve ( "plan.xml" );
288+ packageMetadata .writeToXML ( planPath );
289+
290290 Repository installRepo = new Repository ();
291291 installRepo .setId ( "javapackages-bootstrap-install" );
292292 installRepo .setType ( "jpp" );
0 commit comments