This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes (scala,web : vaadin,cloud:heroku) how to pack jars with the generated project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "(scala,web : vaadin,cloud:heroku) how to pack jars with the generated project?" Watch "(scala,web : vaadin,cloud:heroku) how to pack jars with the generated project?" New topic
Author

(scala,web : vaadin,cloud:heroku) how to pack jars with the generated project?

olivier Saint-Eve
Greenhorn

Joined: Oct 27, 2012
Posts: 1
my problem is not simple to explain.

globally, here is it : I want to deploy on heroku (in the cloud) a scala project, with the support of vaadin (web framework).
for vaadin, I assume there is no problem.

when I try to deploy my project on heroku, I have an error like this :

2012-10-26T23:19:40+00:00 app[web.1]: Exception in thread "main" java.lang.NoCla
ssDefFoundError: scala/ScalaObject

this means the jars are not deployed with the project.

but I don't know what is the form of the generated project, since I assembled some pieces without knowing them deeply (especially vaadin-for-heroku, which manages the embedded tomcat server).when I run a "maven build install" from eclipse I obtain a "jar" but it's locally, not on heroku's website.
the only thing I am sure is heroku launches maven...

here is some code:

The heroku command line:
**************************************
C:\Users\lolveley\Documents\eclipses\heroku\test3-scala>git push heroku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)

-----> Heroku receiving push
-----> Java app detected
-----> Installing OpenJDK 1.6...done
-----> Installing settings.xml... done
-----> executing /app/tmp/repo.git/.cache/.maven/bin/mvn -B -Duser.home=/tmp/bui
ld_3kg03suerfnle -Dmaven.repo.local=/app/tmp/repo.git/.cache/.m2/repository -s /
app/tmp/repo.git/.cache/.m2/settings.xml -DskipTests=true clean install
[INFO] Scanning for projects...
[INFO]

[INFO] ------------------------------------------------------------------
------
[INFO] Building test3-scala 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------
------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ test3-scala -
--
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ t
est3-scala ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/build_3kg03suerfnle/src/m
ain/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ test3-
scala ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-scala-plugin:2.15.0:compile (default) @ test3-scala ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] /tmp/build_3kg03suerfnle/src/main/java:-1: info: compiling
[INFO] Compiling 2 source files to /tmp/build_3kg03suerfnle/target/classe
s at 1351296626402
[INFO] No known dependencies. Compiling everything
[INFO] prepare-compile in 0 s
[INFO] compile in 6 s
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResour
ces) @ test3-scala ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/build_3kg03suerfnle/src/t
est/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile)
@ test3-scala ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-scala-plugin:2.15.0:testCompile (default) @ test3-scala
---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] /tmp/build_3kg03suerfnle/src/test/java:-1: info: compiling
[INFO] Compiling 3 source files to /tmp/build_3kg03suerfnle/target/test-c
lasses at 1351296632708
[INFO] No known dependencies. Compiling everything
[INFO] prepare-compile in 0 s
[INFO] compile in 8 s
[INFO]
[INFO] --- maven-surefire-plugin:2.6:test (default-test) @ test3-scala --
-
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ test3-scala ---
[INFO] Building jar: /tmp/build_3kg03suerfnle/target/test3-scala-0.0.1-SN
APSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ test3-s
cala ---
[INFO] Installing /tmp/build_3kg03suerfnle/target/test3-scala-0.0.1-SNAPS
HOT.jar to /app/tmp/repo.git/.cache/.m2/repository/tests/test3-scala/0.0.1-SNAPS
HOT/test3-scala-0.0.1-SNAPSHOT.jar
[INFO] Installing /tmp/build_3kg03suerfnle/pom.xml to /app/tmp/repo.git/.
cache/.m2/repository/tests/test3-scala/0.0.1-SNAPSHOT/test3-scala-0.0.1-SNAPSHOT
.pom
[INFO] ------------------------------------------------------------------
------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------
------
[INFO] Total time: 21.211s
[INFO] Finished at: Sat Oct 27 00:10:41 UTC 2012
[INFO] Final Memory: 9M/490M
[INFO] ------------------------------------------------------------------
------
-----> Discovering process types
Procfile declares types -> web
-----> Compiled slug size: 41.6MB
-----> Launching... done, v10
**************************************


the heroku procfile:

web: java $JAVA_OPTS -cp target/classes:target/dependency/* tests.test3scala.App


the pom.xml file:
**********************************


the web sites I used : [vaadin-for-heroku] : https://github.com/nhurion/vaadin-for-heroku

[hello-vaadin-heroku]:https://github.com/nhurion/hello-vaadin-heroku

[embed-for-vaadin] : https://vaadin.com/directory#addon/embed-for-vaadin

thank you if you can help me, especially to integrate the jars in the generated project (by modifying the pom.xml file)

olivier
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

I assume that the missing class is in this dependency, you should verify that by looking in the JAR:


You POM doesn't have a <packaging> clause which means it will create a JAR file. The JAR is not self-contained. That is, it contains the compiled classes but not any of the classes referenced in the dependencies. So the first question is: did you really mean to build a JAR? If you meant to build a WAR instead, add a packaging type. (Or is there a specific packaging type for building a Scala JAR file??? Not having worked with Scala I'm reduced to guessing...)

If you meant to create a a JAR file that includes all dependencies, then you also have to include the Maven Assembly Plugin, it can build a self-sufficient JAR.


JBoss In Action
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: (scala,web : vaadin,cloud:heroku) how to pack jars with the generated project?