@@ -213,16 +213,24 @@ object RepublishPlugin extends AutoPlugin {
213
213
val classpaths = coursierFetch(coursierJar, log, csrCacheDir, localRepo, resolvedLocal.map(_.id.toString))
214
214
215
215
if (commandLibs.nonEmpty) {
216
- IO .createDirectory(republishDir / " etc " )
216
+ IO .createDirectory(republishDir / " lib " )
217
217
for ((command, libs) <- commandLibs) {
218
218
val (negated, actual) = libs.partition(_.startsWith(" ^!" ))
219
219
val subtractions = negated.map(_.stripPrefix(" ^!" ))
220
220
221
221
def compose (libs : List [String ]): List [String ] =
222
222
libs.map(fuzzyFind(classpaths, _)).reduceOption(_ ++ _).map(_.distinct).getOrElse(Nil )
223
-
223
+
224
+ // Compute the classpath entries
224
225
val entries = compose(actual).diff(compose(subtractions))
225
- IO .write(republishDir / " etc" / s " $command.classpath " , entries.mkString(" \n " ))
226
+ // Generate the MANIFEST for the pathing jar
227
+ val manifest = new java.util.jar.Manifest ();
228
+ manifest.getMainAttributes().put(java.util.jar.Attributes .Name .MANIFEST_VERSION , " 1.0" );
229
+ manifest.getMainAttributes().put(java.util.jar.Attributes .Name .CLASS_PATH , entries.map(e => s " ../maven2/ $e" ).mkString(" " ))
230
+ // Write the pathing jar to the Disk
231
+ val file = republishDir / " lib" / s " $command.jar "
232
+ val jar = new java.util.jar.JarOutputStream (new java.io.FileOutputStream (file), manifest)
233
+ jar.close()
226
234
}
227
235
}
228
236
0 commit comments