@@ -88,6 +88,9 @@ public void run(RestxShell shell) throws Exception {
88
88
} else if (ModuleDescriptorType .MAVEN .equals (moduleDescriptorTypeWithExistingFile )) {
89
89
shell .println ("installing deps using maven descriptor..." );
90
90
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 ()));
91
94
} else {
92
95
throw new IllegalArgumentException ("Unsupported deps install for module type " +moduleDescriptorTypeWithExistingFile );
93
96
}
@@ -98,29 +101,34 @@ public void run(RestxShell shell) throws Exception {
98
101
}
99
102
100
103
private void installDepsFromModuleDescriptor (RestxShell shell , File mdFile ) throws Exception {
101
- Ivy ivy = ShellIvy .loadIvy (shell );
102
104
File tempFile = File .createTempFile ("restx-md" , ".ivy" );
103
105
try (FileInputStream is = new FileInputStream (mdFile )) {
104
106
ModuleDescriptor descriptor = new RestxJsonSupport ().parse (is );
105
107
try (BufferedWriter w = Files .newWriter (tempFile ,Charsets .UTF_8 )) {
106
108
new IvySupport ().generate (descriptor , w );
107
109
}
108
110
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 );
119
112
} finally {
120
113
tempFile .delete ();
121
114
}
122
115
}
123
116
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
+
124
132
private void installDepsFromMavenDescriptor (RestxShell shell , File pomFile ) throws Exception {
125
133
AppSettings appSettings = shell .getFactory ().getComponent (AppSettings .class );
126
134
0 commit comments