Comments (21)
-
please try 1.0.2 development release
https://bintray.com/random-maven/maven/scalor-maven-plugin_2.12 -
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
from scalor-maven-plugin.
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!
from scalor-maven-plugin.
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]
from scalor-maven-plugin.
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!
from scalor-maven-plugin.
thanks, now I can reproduce problem 100%
from scalor-maven-plugin.
-
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
from scalor-maven-plugin.
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.
from scalor-maven-plugin.
-
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
:-)
from scalor-maven-plugin.
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!
from scalor-maven-plugin.
sure, as long as you export
https://www.scala-js.org/doc/interoperability/export-to-javascript.html
from scalor-maven-plugin.
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.
from scalor-maven-plugin.
right.
I am re-doing linker for incremental support, things will change.
so, keep posting your wish list :-)
from scalor-maven-plugin.
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.
from scalor-maven-plugin.
-
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>
<!-- B) actually start web client, by specific reference to the global object -->
<script> App.main(); </script>
- 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
from scalor-maven-plugin.
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. :-)
from scalor-maven-plugin.
sure, you will have some form of scalaJSUseMainModuleInitializer
bring it in
:-)
from scalor-maven-plugin.
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.
from scalor-maven-plugin.
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
from scalor-maven-plugin.
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
from scalor-maven-plugin.
assume resolved
from scalor-maven-plugin.
@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
from scalor-maven-plugin.
Related Issues (20)
- relax plugin version verification rules HOT 7
- work around nsc.Settings ignoring `-D` user-set state HOT 6
- proper implementation for `scala.compiler.additionalParams` HOT 3
- use separate source regex for compile and scaladoc HOT 14
- use constant default options for JavaC and ScalaC HOT 4
- validate compile phases HOT 3
- mysterious encoding during flatten:flatten HOT 13
- zinc server HOT 1
- document windows build setup HOT 3
- Problems compiling twirl-templates HOT 1
- Provide Scala.js sbt plugin to Maven translation guide
- Provide Scala.js sbt plugin to Scalor mapping guide
- Scala library doesn't get picked if it's in test scope HOT 3
- Plugin thinks default target is 1.8, but is 1.6 when compiling for Scala 2.11.12 HOT 1
- Better advanced usage link HOT 2
- Bloop support HOT 2
- Scala source code to javadoc HOT 5
- Scala 3 Support
- Build Not Working Due to Bintray
- how to use in idea for scala.js?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalor-maven-plugin.