@@ -88,6 +88,9 @@ public void run(RestxShell shell) throws Exception {
8888 } else if (ModuleDescriptorType .MAVEN .equals (moduleDescriptorTypeWithExistingFile )) {
8989 shell .println ("installing deps using maven descriptor..." );
9090 installDepsFromMavenDescriptor (shell , ModuleDescriptorType .MAVEN .resolveDescriptorFile (shell .currentLocation ()));
91+ } else if (ModuleDescriptorType .IVY .equals (moduleDescriptorTypeWithExistingFile )) {
92+ shell .println ("installing deps using ivy descriptor..." );
93+ installDepsFromIvyDescriptor (shell , ModuleDescriptorType .IVY .resolveDescriptorFile (shell .currentLocation ()));
9194 } else {
9295 throw new IllegalArgumentException ("Unsupported deps install for module type " +moduleDescriptorTypeWithExistingFile );
9396 }
@@ -98,29 +101,34 @@ public void run(RestxShell shell) throws Exception {
98101 }
99102
100103 private void installDepsFromModuleDescriptor (RestxShell shell , File mdFile ) throws Exception {
101- Ivy ivy = ShellIvy .loadIvy (shell );
102104 File tempFile = File .createTempFile ("restx-md" , ".ivy" );
103105 try (FileInputStream is = new FileInputStream (mdFile )) {
104106 ModuleDescriptor descriptor = new RestxJsonSupport ().parse (is );
105107 try (BufferedWriter w = Files .newWriter (tempFile ,Charsets .UTF_8 )) {
106108 new IvySupport ().generate (descriptor , w );
107109 }
108110
109- shell .println ("resolving dependencies..." );
110- ResolveReport resolveReport = ivy .resolve (tempFile );
111-
112- shell .println ("synchronizing dependencies in " + shell .currentLocation ().resolve ("target/dependency" ) + " ..." );
113- ivy .retrieve (resolveReport .getModuleDescriptor ().getModuleRevisionId (),
114- new RetrieveOptions ()
115- .setDestArtifactPattern (
116- shell .currentLocation ().toAbsolutePath () + "/target/dependency/[artifact]-[revision](-[classifier]).[ext]" )
117- .setSync (true )
118- );
111+ installDepsFromIvyDescriptor (shell , tempFile );
119112 } finally {
120113 tempFile .delete ();
121114 }
122115 }
123116
117+ private void installDepsFromIvyDescriptor (RestxShell shell , File ivyFile ) throws Exception {
118+ Ivy ivy = ShellIvy .loadIvy (shell );
119+
120+ shell .println ("resolving dependencies..." );
121+ ResolveReport resolveReport = ivy .resolve (ivyFile );
122+
123+ shell .println ("synchronizing dependencies in " + shell .currentLocation ().resolve ("target/dependency" ) + " ..." );
124+ ivy .retrieve (resolveReport .getModuleDescriptor ().getModuleRevisionId (),
125+ new RetrieveOptions ()
126+ .setDestArtifactPattern (
127+ shell .currentLocation ().toAbsolutePath () + "/target/dependency/[artifact]-[revision](-[classifier]).[ext]" )
128+ .setSync (true )
129+ );
130+ }
131+
124132 private void installDepsFromMavenDescriptor (RestxShell shell , File pomFile ) throws Exception {
125133 AppSettings appSettings = shell .getFactory ().getComponent (AppSettings .class );
126134
0 commit comments