@@ -213,16 +213,24 @@ object RepublishPlugin extends AutoPlugin {
213213 val classpaths = coursierFetch(coursierJar, log, csrCacheDir, localRepo, resolvedLocal.map(_.id.toString))
214214
215215 if (commandLibs.nonEmpty) {
216- IO .createDirectory(republishDir / " etc " )
216+ IO .createDirectory(republishDir / " lib " )
217217 for ((command, libs) <- commandLibs) {
218218 val (negated, actual) = libs.partition(_.startsWith(" ^!" ))
219219 val subtractions = negated.map(_.stripPrefix(" ^!" ))
220220
221221 def compose (libs : List [String ]): List [String ] =
222222 libs.map(fuzzyFind(classpaths, _)).reduceOption(_ ++ _).map(_.distinct).getOrElse(Nil )
223-
223+
224+ // Compute the classpath entries
224225 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()
226234 }
227235 }
228236
0 commit comments