Closed PaulAtBanno closed 6 years ago
1) please try 1.0.2 development release https://bintray.com/random-maven/maven/scalor-maven-plugin_2.12
2) please post zip of maven console output https://www.ibm.com/support/knowledgecenter/SS8PJ7_9.1.0/com.ibm.etools.maven.doc/topics/troubleshooting.html
OK, here is logs.zip, which includes my current pom.xml, the Maven console output, and the stacktrace taken from the resulting alert. Thanks for the new plugin, which I'm very excited about, and for looking into this!
thanks - from zips it looks like I depend on wrong version of M2E (you use 1.8 (?) vs I use 1.9)
please attach zip (with sanitized system properties) eclipse config (so I can verify your plugin versions):
Eclipse -> Help -> About Eclipse -> Installation Details -> Configuration -> [select / copy / save]
You're exactly right: I use 1.8.2, and in fact can't find a "1.9" anywhere. Here is configuration.txt.zip for confirmation. Thanks again!
thanks, now I can reproduce problem 100%
here is the fix https://github.com/random-maven/scalor-maven-plugin/blob/master/src/main/scala/com/carrotgarden/maven/scalor/eclipse/Maven.scala#L243
please try release 1.0.3 http://search.maven.org/#search%7Cga%7C1%7Cscalor-maven-plugin_2.12
with demo project (clone / copy / paste) https://github.com/random-maven/scalor-maven-plugin/tree/master/demo
With the latest plugin, updating my Maven settings gets me this Maven console:
1/16/18, 4:06:18 PM EST: [INFO] Update started
1/16/18, 4:06:19 PM EST: [INFO] Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: com.duck:invest:0.0.1-SNAPSHOT @ /Users/psnively/eclipse-workspace/invest/pom.xml.
1/16/18, 4:06:22 PM EST: [INFO] Adding source folder /invest/src/main/java
1/16/18, 4:06:22 PM EST: [INFO] Adding resource folder /invest/src/main/resources
1/16/18, 4:06:22 PM EST: [INFO] Adding source folder /invest/src/test/java
1/16/18, 4:06:22 PM EST: [INFO] Adding resource folder /invest/src/test/resources
1/16/18, 4:06:23 PM EST: [INFO] Update completed: 5 sec
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] Using Eclipse platform plugins:
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.core.resources_3.12.0.v20170417-1558 [122]
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.m2e.core_1.8.2.20171007-0217 [572]
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.m2e.core.ui_1.8.2.20171007-0217 [573]
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] Configuring companion Eclipse plugin:
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] pluginId: com.carrotgarden.maven.scalor-maven-plugin_2.12_1.0.3.20180115180433
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] location: file:/Users/psnively/.m2/repository/com/carrotgarden/maven/scalor-maven-plugin_2.12/1.0.3.20180115180433/scalor-maven-plugin_2.12-1.0.3.20180115180433.jar
1/16/18, 4:06:25 PM EST: [INFO] [scalor] Plugin start: com.carrotgarden.maven.scalor-maven-plugin_2.12_1.0.3.20180115180433
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] Companion plugin installed in Eclipse: com.carrotgarden.maven.scalor-maven-plugin_2.12_1.0.3.20180115180433_0.0.0 [1973]
1/16/18, 4:06:25 PM EST: [INFO] [scalor:eclipse-config] Scheduling project update in Eclipse to invoke M2E project configurator.
1/16/18, 4:06:25 PM EST: [WARN] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
1/16/18, 4:06:25 PM EST: [INFO] Copying 0 resource
1/16/18, 4:06:25 PM EST: [WARN] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
1/16/18, 4:06:25 PM EST: [INFO] Copying 0 resource
1/16/18, 4:06:26 PM EST: [INFO] Update started
1/16/18, 4:06:26 PM EST: [INFO] Using org.eclipse.m2e.jdt.JarLifecycleMapping lifecycle mapping for MavenProject: com.duck:invest:0.0.1-SNAPSHOT @ /Users/psnively/eclipse-workspace/invest/pom.xml.
1/16/18, 4:06:26 PM EST: [INFO] [scaler:step#1] Configuring dependency classpath.
1/16/18, 4:06:26 PM EST: [INFO] [scaler:step#1] Verifying Maven M2E version.
1/16/18, 4:06:26 PM EST: [INFO] [scaler:step#1] version 1.8.2.20171007-0217 is in range [1.8.0,1.10.0)
1/16/18, 4:06:26 PM EST: [INFO] [scaler:step#1] Verifying Scala IDE version.
1/16/18, 4:06:26 PM EST: [INFO] [scaler:step#1] version 4.7.0.v-2_12-201709291352-71a28d0 is in range [4.7.0,4.7.2)
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-macro] Registering root: /Users/psnively/eclipse-workspace/invest/src/macro/java
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-macro] Registering root: /Users/psnively/eclipse-workspace/invest/src/macro/scala
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-macro] Already registered: /Users/psnively/eclipse-workspace/invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-macro] Ensuring build folders.
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-main] Already registered: /Users/psnively/eclipse-workspace/invest/src/main/resources
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-main] Already registered: /Users/psnively/eclipse-workspace/invest/src/main/java
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-main] Registering root: /Users/psnively/eclipse-workspace/invest/src/main/scala
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-main] Already registered: /Users/psnively/eclipse-workspace/invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-main] Ensuring build folders.
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-test] Already registered: /Users/psnively/eclipse-workspace/invest/src/test/resources
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-test] Already registered: /Users/psnively/eclipse-workspace/invest/src/test/java
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-test] Registering root: /Users/psnively/eclipse-workspace/invest/src/test/scala
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-test] Already registered: /Users/psnively/eclipse-workspace/invest/target/test-classes
1/16/18, 4:06:27 PM EST: [INFO] [scalor:register-test] Ensuring build folders.
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/main/java
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/macro/java
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/macro/scala
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/main/scala
1/16/18, 4:06:27 PM EST: [INFO] Adding resource folder /invest/src/main/resources
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/test/java
1/16/18, 4:06:27 PM EST: [INFO] Adding source folder /invest/src/test/scala
1/16/18, 4:06:27 PM EST: [INFO] Adding resource folder /invest/src/test/resources
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] Configuring project classpath.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/macro/java -> /invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/macro/scala -> /invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/main/resources -> /invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/main/java -> /invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/main/scala -> /invest/target/classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/test/resources -> /invest/target/test-classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/test/java -> /invest/target/test-classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] /invest/src/test/scala -> /invest/target/test-classes
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] Deleting container org.scala-ide.sdt.launching.SCALA_CONTAINER.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#2] Ordering top level entries inside the .classpath.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#1] Configuring dependency classpath.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Configuring project settings.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Hacking .project symbolic links.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Applying Eclipse .project comment.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Ensuring project natures.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Ordering Eclipse .project builder entries.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Ordering Eclipse .project nature entries.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Configuring Scala IDE.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3] Resolving custom Scala installation.
1/16/18, 4:06:27 PM EST: [INFO] Update completed: 1 sec
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Configuring Scala IDE (scheduled job).
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Persisting custom Scala installation.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Updating project Scala settings.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Providing configured settings.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Resetting preferences to default.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Persisting compiler selection.
1/16/18, 4:06:27 PM EST: [INFO] [scaler:step#3+] Persisting configured settings.
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] Using Eclipse platform plugins:
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.core.resources_3.12.0.v20170417-1558 [122]
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.m2e.core_1.8.2.20171007-0217 [572]
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] org.eclipse.m2e.core.ui_1.8.2.20171007-0217 [573]
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] Configuring companion Eclipse plugin:
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] pluginId: com.carrotgarden.maven.scalor-maven-plugin_2.12_1.0.3.20180115180433
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] location: file:/Users/psnively/.m2/repository/com/carrotgarden/maven/scalor-maven-plugin_2.12/1.0.3.20180115180433/scalor-maven-plugin_2.12-1.0.3.20180115180433.jar
1/16/18, 4:06:32 PM EST: [INFO] [scalor:eclipse-config] Companion plugin is already installed: com.carrotgarden.maven.scalor-maven-plugin_2.12_1.0.3.20180115180433_0.0.0 [1973]
1/16/18, 4:06:32 PM EST: [WARN] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
1/16/18, 4:06:32 PM EST: [INFO] Copying 0 resource
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] Detected scalajs-library: 2.11-0.6.21.
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] Scala.js linker args:
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] --output
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] /Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] --fastOpt
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] --sourceMap
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] --debug
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] --prettyPrint
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] /Users/psnively/eclipse-workspace/invest/target/classes
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] /Users/psnively/.m2/repository/org/scala-js/scalajs-library_2.11/0.6.21/scalajs-library_2.11-0.6.21.jar
1/16/18, 4:06:32 PM EST: [INFO] [scalor:link-scala-js-main] Invoking Scala.js linker.
1/16/18, 4:06:34 PM EST: [WARN] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
1/16/18, 4:06:34 PM EST: [INFO] Copying 0 resource
1/16/18, 4:06:34 PM EST: [INFO] [scalor:link-scala-js-test] Missing scalajs-library, skipping execution.
I think it's correct. In particular, I have target/classes/tutorial/webapp/TutorialApp$.sjsir
from compiling to JavaScript. What I don't see (or know how to look for?) is the linked .js
combination of that and the runtime. Or is that what's meant by the argument to --output
, i.e. /Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js
is the linked program?
Thanks again! I think you can close this ticket, as the bug has clearly been fixed; the rest is just a gap in my understanding.
log looks about right
*.sjsir
are scala classes compiled into IR - intermediate representation of JavaScript
META-INF/resources/script/runtime.js
is result of linking of these classes for deployment
please try to test plugin now with M2E 1.9 https://repository.takari.io/content/sites/m2e.extras/m2e/1.9.0/N/LATEST/
congratulations, you earned a badge: First Successful User
:-)
It also builds fine with Maven 3.5.2 and m2e 1.9, so I think it's good.
I'm still confused by one thing, though. If I have this source code:
package tutorial.webapp
object TutorialApp {
def main(args: Array[String]): Unit = {
println("Hello world!")
}
}
shouldn't I then be able to say:
node runtime.js
in the target/classes/META-INF/resources/script
directory, and see:
Hello world!
in the console?
Thanks so much!
sure, as long as you export https://www.scala-js.org/doc/interoperability/export-to-javascript.html
No dice. Here's my source code now:
package tutorial.webapp
import scala.scalajs.js.annotation._
@JSExportTopLevel("TutorialApp")
object TutorialApp {
@JSExport
def main(args: Array[String]): Unit = {
println("Hello world!")
}
}
but
node runtime.js
still produces nothing:
⇒ node runtime.js
psnively@Ragnarok:~/eclipse-workspace/invest/target/classes/META-INF/resources/script|
⇒
I think there's something I'm still missing about how to specify that tutorial.webapp.TutorialApp.main
should be the entry point, as far as JavaScript is concerned.
Update: I think we need the equivalent of scalaJSUseMainModuleInitializer := true
from sbt, somehow.
right. I am re-doing linker for incremental support, things will change. so, keep posting your wish list :-)
OK, but... this seems kind of fundamental, right? It seems like the link-scala-js-main
goal should produce a JavaScript file you can just run with any JavaScript runtime. In other words, the contents of the Basic tutorial from Scala.js should apply, maybe apart from having to run node.js manually (but it also seems like interop with the frontend-maven-plugin would be useful).
So I guess my immediate question is: what do I need to do to actually build a runnable JavaScript application with this plugin? This is admittedly mostly for validation purposes, as I do ultimately expect to be browser-based rather than standalone. I'm just trying to get from "Hello, world" to that point incrementally.
I think not "very fundamental" - there is no main()
convention in JavaScript
in web context, you normally provide something to the effect A + B
:
<!-- A) inject runtime, must provide some global object, say "App" -->
<script src="./server-provided-path/runtime.js"></script>
3. re: "to actually build a runnable " - you already have;
a) try to run it with
node --eval "App.main()"
b) or, skip the `node.js` and try to make simple `index.html` with script example
similar to the above, and open it in the browser,
locally as url `file://...`, for example:
https://github.com/sjrd/scala-js-example-app/blob/master/index.html
I think not "very fundamental" - there is no main() convention in JavaScript
Understood, hence my comment about maybe wanting to support something like sbt's scalaJSUseMainModuleInitializer := true
. In other words, there apparently is a notion of "main module," and there apparently is some way it can be "initialized" such that the resulting JavaScript does expose an entry point in some sense that, e.g. node.js understands.
Now, you can certainly observe (and I could easily understand) that's specific to the sbt plugin and is out of scope for what you're trying to achieve. But you did encourage me to keep spelling out my wish list. :-)
sure, you will have some form of scalaJSUseMainModuleInitializer
bring it in
:-)
In the meantime:
psnively@Ragnarok:~|⇒ node -e 'require("/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js"); TutorialApp.main()'
/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:213
throw new $c_sjsr_UndefinedBehaviorError().init___jl_Throwable(
^
Error
at $c_sjsr_UndefinedBehaviorError.$c_jl_Throwable.fillInStackTrace__jl_Throwable (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:1738:14)
at $c_sjsr_UndefinedBehaviorError.fillInStackTrace__jl_Throwable (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:2756:67)
at $c_sjsr_UndefinedBehaviorError.$c_jl_Throwable.init___T__jl_Throwable (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:1754:8)
at $c_sjsr_UndefinedBehaviorError.init___T__jl_Throwable (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:2763:52)
at $c_sjsr_UndefinedBehaviorError.init___jl_Throwable (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:2759:67)
at $throwClassCastException (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:213:46)
at $throwArrayCastException (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:222:3)
at $asArrayOf_T (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:2289:64)
at $c_Ltutorial_webapp_TutorialApp$.main (/Users/psnively/eclipse-workspace/invest/target/classes/META-INF/resources/script/runtime.js:1153:15)
at [eval]:1:118
So the good news is the export annotations are working, compiling is working, and linking is working. But there's apparently still something I'm misunderstanding about how to actually use the result.
great.
now try to reproduce same result with browser / index.html
it is easier to debug with UI, i.e. https://developer.chrome.com/devtools
please try 1.1.0 release http://search.maven.org/#search%7Cga%7C1%7Cscalor-maven-plugin_2.12
use demo project as reference https://github.com/random-maven/scalor-maven-plugin/tree/master/demo
assume resolved
@PaulAtBanno FYI: Scala.js module initializes are now supported: https://random-maven.github.io/scalor-maven-plugin/2.12/scala-js-link-main-mojo.html#linkerMainInitializerList
Creating a simple Maven project with the following pom.xml exhibits the above error when updating the project settings:
Replacing the new project's pom.xml rightly presents the issue that the project's settings need updating. Doing so, however, results in the error in the subject.