@@ -104,17 +104,16 @@ public void generate() throws Exception {
104104 TypeScriptGenerator .printVersion ();
105105
106106 // class loader
107- final List <URL > urls = new ArrayList <>();
107+ final Set <URL > urls = new LinkedHashSet <>();
108108 for (Task task : getProject ().getTasks ()) {
109109 if (task .getName ().startsWith ("compile" )) {
110110 for (File file : task .getOutputs ().getFiles ()) {
111111 urls .add (file .toURI ().toURL ());
112112 }
113113 }
114114 }
115- for (File file : getProject ().getConfigurations ().getAt ("compile" ).getFiles ()) {
116- urls .add (file .toURI ().toURL ());
117- }
115+ urls .addAll (getFilesFromConfiguration ("compile" ));
116+ urls .addAll (getFilesFromConfiguration ("compileClasspath" ));
118117
119118 try (URLClassLoader classLoader = Settings .createClassLoader (getProject ().getName (), urls .toArray (new URL [0 ]), Thread .currentThread ().getContextClassLoader ())) {
120119
@@ -205,4 +204,17 @@ public void generate() throws Exception {
205204 }
206205 }
207206
207+ private List <URL > getFilesFromConfiguration (String configuration ) {
208+ try {
209+ final List <URL > urls = new ArrayList <>();
210+ for (File file : getProject ().getConfigurations ().getAt (configuration ).getFiles ()) {
211+ urls .add (file .toURI ().toURL ());
212+ }
213+ return urls ;
214+ } catch (Exception e ) {
215+ TypeScriptGenerator .getLogger ().warning (String .format ("Cannot get file names from configuration '%s': %s" , configuration , e .getMessage ()));
216+ return Collections .emptyList ();
217+ }
218+ }
219+
208220}
0 commit comments