Yeah, I’m thinking of generalizing this Spec2Runner and ZincRunner classes into a library that enables Java to run Scala main objects.
> On Aug 16, 2016, at 8:10 AM, Alex Boisvert <alex.boisv...@gmail.com> wrote: > > Ha ha. You can't win the Java game in "hard mode" without dealing with the > classloader bosses. ;) > > On Aug 16, 2016 7:43 AM, "Antoine Toulme" <anto...@toulme.name> wrote: > >> It took a while to get it right. >> >> -I needed a Java wrapper class to call out to the Main object on the >> compiler. I took after Specs2Runner. >> -Even then, zinc kept failing missing scala.reflect packages. This was >> very weird since the classpath definitely contained those classes. >> I eventually found out that zinc plays with the classloader and takes >> several arguments: -scala-library, -scala-compiler, and a new one, >> -scala-extra. (https://github.com/typesafehub/zinc <https://github.com/ >> typesafehub/zinc> gave it away). >> Adding -scala-extra, pointing at the scala-reflect jar fixed the issue. >> >> Cheers, >> >> Antoine >> >>> On Aug 16, 2016, at 7:20 AM, Alex Boisvert <alex.boisv...@gmail.com> >> wrote: >>> >>> Nice, thanks for bringing zinc back. >>> >>> On Mon, Aug 15, 2016 at 11:38 PM, Antoine Toulme <anto...@toulme.name> >>> wrote: >>> >>>> Just brought zinc back in. Had to do a little dancing around with a Java >>>> class to call out to the Scala main object. >>>> >>>> Here is the commit: >>>> >>>> [master 749acfe] Bring back zinc compiler, using the latest version and >> a >>>> runner class >>>> 5 files changed, 183 insertions(+), 5 deletions(-) >>>> create mode 100644 lib/buildr/scala/org/apache/buildr/ZincRunner.class >>>> create mode 100644 lib/buildr/scala/org/apache/buildr/ZincRunner.java >>>> >>>>> On Aug 15, 2016, at 4:49 PM, Antoine Toulme <anto...@toulme.name> >> wrote: >>>>> >>>>> On Aug 15, 2016, at 3:47 PM, Alex Boisvert <alex.boisv...@gmail.com> >>>> wrote: >>>>>> >>>>>> On Mon, Aug 15, 2016 at 3:24 PM, Antoine Toulme <anto...@toulme.name> >>>> wrote: >>>>>> >>>>>>> Two things had to go to make it happen: >>>>>>> -the Zinc compiler’s last release was 6 years ago, and it doesn’t >> seem >>>> to >>>>>>> play well with the latest. I have removed it. >>>>>>> >>>>>> >>>>>> Zinc's last release was about a month ago (July 3rd); I think you >> might >>>>>> have been looking at older artifacts / older organization in maven2 >>>> repo? >>>>>> >>>>>> https://github.com/typesafehub/zinc >>>>>> >>>>>> No biggie, just mentioning it. >>>>> >>>>> OK, I missed it: >>>>> http://central.maven.org/maven2/com/typesafe/zinc/zinc/0.3.12/ < >>>> http://central.maven.org/maven2/com/typesafe/zinc/zinc/0.3.12/> >>>>> >>>>> OK, let me try to bring this back in. >>>>> >>>>> I looked at this new Zinc incarnation from SBT and found that it has a >>>> first 1.0.0-X1 build out there: >>>>> http://mvnrepository.com/artifact/org.scala-sbt/zinc_2.11 < >>>> http://mvnrepository.com/artifact/org.scala-sbt/zinc_2.11> >>>>> >>>>> Here is the code: >>>>> https://github.com/sbt/zinc <https://github.com/sbt/zinc> >>>>> >>>>> I tried to use it but could not find the main class like the old one. >>>> >>>> >> >>