Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
Unable to Publish SBT Plugin
-
Example repo on github here: https://github.com/nspottsie/inedo-proget-sbt-publish-example
Issue
When publishing a SBT plugin to ProGet, the publish step fails.
Steps to Reproduce
-
SBT is installed on your machine http://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html
-
cd
to repo root -
Modify build.sbt to point to ProGet server
Here it assumes there’s one running on localhost:8080 and that there is a user named publisher who has permission to publish packages. Build.sbt also assumes there’s a maven feed named maven-libraries
-
Run
sbt publish
on the command line
Expected Results
sbt-test-plugin-1.0.35 is published to Proget
Actual Results
[info] Packaging /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/sbt-test-plugin-1.0.35-sources.jar ... [info] Done packaging. [info] Updating {file:/Users/je185066/repos/silver/samza-sbt/proget-repro/}proget-repro... [info] Wrote /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/sbt-test-plugin-1.0.35.pom [info] Resolving org.fusesource.jansi#jansi;1.4 ... [info] Done updating. [info] :: delivering :: com.test#sbt-test-plugin;1.0.35 :: 1.0.35 :: integration :: Mon Mar 06 11:40:36 EST 2017 [info] delivering ivy file to /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/ivy-1.0.35.xml [info] Main Scala API documentation to /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/api... [info] Compiling 1 Scala source to /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/classes... model contains 6 documentable templates [info] Packaging /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/sbt-test-plugin-1.0.35.jar ... [info] Done packaging. [info] Main Scala API documentation successful. [info] Packaging /Users/je185066/repos/silver/samza-sbt/proget-repro/target/scala-2.10/sbt-0.13/sbt-test-plugin-1.0.35-javadoc.jar ... [info] Done packaging. java.io.IOException: PUT operation to URL http://localhost:8080/maven2/maven-libraries/com/test/sbt-test-plugin_2.10_0.13/1.0.35/sbt-test-plugin-1.0.35.pom failed with status code 500: Internal Server Error``` #### Server Log ```Unhandled exception processing /maven2/maven-libraries/com/test/sbt-test-plugin_2.10_0.13/1.0.35/sbt-test-plugin-1.0.35.pom System.ArgumentNullException: Value cannot be null. Parameter name: package at Inedo.ProGet.Feeds.Maven.MavenFeed.InstallPackage(String groupId, String artifactId, String version, String package, Stream packageStream) at Inedo.ProGet.WebApplication.SimpleHandlers.Maven.MavenHandler.ProcessRequest2(HttpContext context) at Inedo.ProGet.WebApplication.SimpleHandlers.Maven.MavenHandler.ProcessRequestInternalAsync(HttpContext context) at Inedo.ProGet.WebApplication.SimpleHandlers.ApiHandlerBase.<ProcessRequestAsync>d__0.MoveNext()``` #### Root Cause SBT plugins are designed to be cross compiled for multiple scala and sbt versions, and so when IsPlugin := true is added to a build.sbt file, and the artifact is published, it is published to a url containing the artifact name which contains the scala version, and sbt version. For example, http://localhost:8080/maven2/maven-libraries/com/test/sbt-test-plugin_2.10_0.13/1.0.35/sbt-test-plugin-1.0.35.pom. But, the file name does not contain those two pieces of information. The MavenRequestInfo.PackageType method expects that both parts match, and when it doesn’t, it returns null for the package type. This generates a NullArgumentException during the publish stage. Product: ProGet Version: 4.7.6
-
-
I am able to reproduce this locally. It looks like you are correct about the root cause being
artifactId-version
not being a prefix of the filename.
-
My team is affected by this as well. Any plans to release a fix? Or if anyone knows a workaround in SBT to change the publish path so the directory and file names match.
-
THis is logged as a bug for [PG-758], and we may get this in next maintence release. Unfortunately it's a non-trivial fix.