-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update ammonite.json to point at new Main #125
Conversation
In com-lihaoyi/Ammonite#1229, the main method was renamed. Running the most recent version of ammonite gives: ``` Error: Main method not found in class ammonite.Main, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application ``` This can be worked around locally by running: `cs launch ammonite -M ammonite.AmmoniteMain -- yourScript.sc`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼 Thanks for this! Just tested it and and it seems to do the trick. @alexarchambault is it alright to merge this in and do a release? Since Ammonite is currently broken.
I think this will break if you specify 2.4.1 or former version. reproduction
See https://get-coursier.io/docs/cli-install#create-an-application-descriptor |
I think that will necessarily be true - the former versions specified a different main class. Without a change like this, any version greater than 2.4.1 will fail... is the descriptor a way to set e.g. a minimum version for this change? The docs don't make it obvious to me how to avoid this. |
I don't think so because main class lookup does not work as mentioned in the doc for now.
MANIFEST.MF
From 2.4.1
But coursier does not seem to use these information. Update This change would work only if ammonite jar contained MANIFEST.MF with Detail
Verbose log says
METAINF/MANIFEST.MF generated by mill lacking these properties. After editting META-INF/MANIFEST.MF like below, I got the log below. Manifest-Version: 1.0
Created-By: Scala mill
Main-Class: ammonite.Main
+ Specification-Title: ammonite
+ Implementation-Vendor-Id: com.lihaoyi
Then, I could install and use ammonite both 2.4.1 and 2.5.0 with this file as both {
"mainClass":"ammonite.AmmoniteMain?",
"repositories": [
"central"
],
"dependencies": [
"com.lihaoyi:::ammonite:latest.release"
],
"classifiers": ["_", "sources"],
"name": "amm"
}
|
It seems that channel json file is per app, not per app and version. Therefore, if you set main class ammonite.main, then it will fail for 2.5.0 and if you set ammonite.AmmoniteMain, then it will fail for 2.4.1 and former for now.
Yes, I agree. |
|
Thanks @blandflakes, that's merged! (I pushed an extra commit to have things keep working with former Ammonite versions too.) |
@alexarchambault Awesome, thanks for showing how to match those earlier versions! |
In com-lihaoyi/Ammonite#1229, the main method was renamed. Running the most recent version of ammonite via coursier gives:
This can be worked around locally by running:
cs launch ammonite -M ammonite.AmmoniteMain -- yourScript.sc