in Eclipse I do this :
and it works :
but in IDEA :
all I get is this :
I don't understand why it's not launching correctly.
I've done the same in Eclipse and IDEA :
Created project with
mvn archetype:generate -DarchetypeGroupId=org.ninjaframework -DarchetypeArtifactId=ninja-servlet-jpa-blog-archetype
cd MY_INSTALLED_PROJECT
mvn clean install
mvn ninja:run
And finally, imported project as a Maven project
And now I'm clueless. Anyone know what I'm doing wrong?
Update : 2018-01-30, still haven't found the solution!
I don't have an answer, but did narrow down the problem. Seems the combination of using Maven 3.5.x (I tested with 3.5.0 and 3.5.2) with JIdea. Here's the command line generated by JIdea to perform "clean" lifecycle:
C:\Dev\GitHub\cas-server>C:\Dev\JavaTools\jdk1.8.0_131\bin\java -Dmaven.home=C:\Dev\JavaTools\apache-maven-3.5.2 -Dclassworlds.conf=C:\Dev\JavaTools\apache-maven-3.2.1\bin\m2.
conf -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Dev\JavaTools\apache-maven-3.2.1\boot\plexus-classworlds-2.5.1.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.5 -X clean
Here I changed just the maven.home to point to Maven 3.2.1 folder, but left all other maven path references pointing at Maven 3.5.2. That works:
C:\Dev\GitHub\cas-server>C:\Dev\JavaTools\jdk1.8.0_131\bin\java -Dmaven.home=C:\Dev\JavaTools\apache-maven-3.2.1 -Dclassworlds.conf=C:\Dev\JavaTools\apache-maven-3.5.2\bin\m2.conf -Didea.launcher.port=7534 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.5\bin" -Dfile.encoding=UTF-8 -classpath "C:\Dev\JavaTools\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 13.1.5\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.5 clean
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cas-overlay 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # cas-overlay ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.390 s
[INFO] Finished at: 2018-02-26T15:12:06-05:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
Add flag
-X
It's verbose mode.
And check maven settings (settings.xml) in Intellij IDEA.
Preferences / Maven / User Settings file
I've checked out https://github.com/arun-gupta/wildfly-samples/tree/master/swarm by Arun Gupta, but when trying to launch the built jar I get Error: Could not find or load main class org.wildfly.swarm.bootstrap.Main.
\wildfly-samples-master\swarm>mvn clean install
[INFO] --- wildfly-swarm-plugin:1.0.0.Alpha1:create (default) # swarm ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # swarm ---
[INFO] Installing \wildfly-samples-master\swarm\target\swarm-1.0-SNAPSHOT.war to \.m2\repository\org\wildfly\samples\swarm\swarm\1.0-SNAPSHOT\swarm-1.0-SNAPSHOT.war
[INFO] Installing \wildfly-samples-master\swarm\pom.xml to \.m2\repository\org\wildfly\samples\swarm\swarm\1.0-SNAPSHOT\swarm-1.0-SNAPSHOT.pom
[INFO] Installing \wildfly-samples-master\swarm\target\swarm-1.0-SNAPSHOT-swarm.jar to \.m2\repository\org\wildfly\samples\swarm\swarm\1.0-SNAPSHOT\swarm-1.0-SNAPSHOT-swarm.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.115 s
[INFO] Finished at: 2015-05-26T21:06:59+01:00
[INFO] Final Memory: 49M/313M
[INFO] ------------------------------------------------------------------------
\wildfly-samples-master\swarm>java -jar target/swarm-1.0-SNAPSHOT-swarm.jar
Error: Could not find or load main class org.wildfly.swarm.bootstrap.Main
\wildfly-samples-master\swarm>mvn --version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00)
Maven home: C:\tools\apache-maven-3.2.1
Java version: 1.7.0_21
Java home: C:\Progra~1\Java\jdk1.7.0_21\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
I do not understand what might be the problem here.
Can someone please advise?
EDIT: I have tried building my own example first but I'm getting the same problem. Referring to an existing example which fails for me was just easier.
This was a known issue in Alpha1
that was already fixed https://github.com/wildfly-swarm/wildfly-swarm/commit/761cdf1848a8720614b20a2272983bcd4e5f3c60
Best to build it from sources until Alpha2 release is done.
These are the official examples:
https://github.com/wildfly-swarm/wildfly-swarm-examples
Alpha4 version (source) has:
EJB support.
More bug fixes.
Static content support. (js,html,css, etc...)
And many others improvements...
I can run my tests using sbt test. When I run the tests using sbt jacoco:cover or sbt jacoco:test and sbt jacoco:report however I get 0 tests, 0 errors, 0 failures. Jacoco sees my test files but not the tests
project/Build.scala
import sbt._
import Keys._
import play.Project._
import de.johoop.jacoco4sbt._
import JacocoPlugin._
object ApplicationBuild extends Build {
val appName = "api"
val appVersion = "0.1-SNAPSHOT"
lazy val s = playJavaSettings ++ Seq(jacoco.settings:_*)
val appDependencies = Seq(
"com.novocode" % "junit-interface" % "0.8" % "test"
)
val main = play.Project(appName, appVersion, appDependencies, settings = s).settings(
**various resolvers**
).settings(
jacoco.settings : _*
).settings(
testOptions in jacoco.Config += Tests.Argument("junitxml")
).settings(
testOptions in jacoco.Config += Tests.Setup( () => System.setProperty("config.file", "conf/application.conf") )
).settings(
parallelExecution in jacoco.Config := false
)
}
project/plugins.sbt
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")
// Use jacoco on sbt builds
libraryDependencies ++= Seq(
"org.jacoco" % "org.jacoco.core" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.core", "jar", "jar")),
"org.jacoco" % "org.jacoco.report" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.report", "jar", "jar"))
)
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.5")
My tests are under the tests directory
I am using:
Play 2.2.1
Java 1.7.0_55
sbt 0.13.2
Most of the answers I found online for people running into the same issue was a matter of parallelExecution not being set to false. When I check sbt jacoco:parallelExecution in the api directory it is set to false. But when I run sbt jacoco:parallelExecution in the project or test directory it is set to true.
It started working once I added
.settings(
Keys.fork in jacoco.Config := true
)
to my Build.scala file. I wish I could explain more on how this worked but it is still a little fuzzy.
Thanks everyone for the answers. It works great locally now, but still getting 0 tests run in Jenkins.
I've just tested it for the first time with the latest Play 2.3.1 and jacoco4sbt 2.1.5, and it worked with no issues. Honestly, I was very much surprised myself how smooth it went.
You don't need the following in project/plugins.sbt:
// Use jacoco on sbt builds
libraryDependencies ++= Seq(
"org.jacoco" % "org.jacoco.core" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.core", "jar", "jar")),
"org.jacoco" % "org.jacoco.report" % "0.5.7.201204190339" artifacts(Artifact("org.jacoco.report", "jar", "jar"))
)
To test it, I first created the Play application using Typesafe Activator using the play-scala template.
➜ sandbox activator new play-jacoco play-scala
Fetching the latest list of templates...
OK, application "play-jacoco" is being created using the "play-scala" template.
To run "play-jacoco" from the command line, "cd play-jacoco" then:
/Users/jacek/sandbox/play-jacoco/activator run
To run the test for "play-jacoco" from the command line, "cd play-jacoco" then:
/Users/jacek/sandbox/play-jacoco/activator test
To run the Activator UI for "play-jacoco" from the command line, "cd play-jacoco" then:
/Users/jacek/sandbox/play-jacoco/activator ui
➜ sandbox cd play-jacoco
I then ran activator to enter the shell and executed test.
➜ play-jacoco activator
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/play-jacoco/project
[info] Updating {file:/Users/jacek/sandbox/play-jacoco/project/}play-jacoco-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to play-jacoco (in build file:/Users/jacek/sandbox/play-jacoco/)
[play-jacoco] $ test
[info] Updating {file:/Users/jacek/sandbox/play-jacoco/}root...
[info] Resolving jline#jline;2.11 ...
[info] Done updating.
[info] Compiling 5 Scala sources and 1 Java source to /Users/jacek/sandbox/play-jacoco/target/scala-2.11/classes...
[info] Compiling 2 Scala sources to /Users/jacek/sandbox/play-jacoco/target/scala-2.11/test-classes...
[info] IntegrationSpec
[info]
[info] Application should
[info] + work from within a browser
[info]
[info] Total for specification IntegrationSpec
[info] Finished in 2 seconds, 615 ms
[info] 1 example, 0 failure, 0 error
[info] ApplicationSpec
[info]
[info] Application should
[info] + send 404 on a bad request
[info] + render the index page
[info]
[info] Total for specification ApplicationSpec
[info] Finished in 130 ms
[info] 2 examples, 0 failure, 0 error
[info] Passed: Total 3, Failed 0, Errors 0, Passed 3
[success] Total time: 17 s, completed Jul 11, 2014 7:57:23 PM
Following the Wiki on jacoco4sbt plugin site on GitHub, I then added jacoco.settings to build.sbt in the top-level directory. I also added addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.1.5") to project/plugins.sbt.
No other changes were made.
I reloaded the activator shell to load the changes.
[play-jacoco] $ reload
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[info] Loading project definition from /Users/jacek/sandbox/play-jacoco/project
[info] Updating {file:/Users/jacek/sandbox/play-jacoco/project/}play-jacoco-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Set current project to play-jacoco (in build file:/Users/jacek/sandbox/play-jacoco/)
When I ran jacoco:cover the plugin executed and displayed the results.
[play-jacoco] $ jacoco:cover
[info] Updating {file:/Users/jacek/sandbox/play-jacoco/}root...
[info] Resolving org.jacoco#org.jacoco.agent;0.7.0.201403182114 ...
[info] Done updating.
[info] ApplicationSpec
[info]
[info] Application should
[info] + send 404 on a bad request
[info] + render the index page
[info]
[info] Total for specification ApplicationSpec
[info] Finished in 22 ms
[info] 2 examples, 0 failure, 0 error
[info] IntegrationSpec
[info]
[info] Application should
[info] + work from within a browser
[info]
[info] Total for specification IntegrationSpec
[info] Finished in 22 ms
[info] 1 example, 0 failure, 0 error
[info] Passed: Total 3, Failed 0, Errors 0, Passed 3
[info]
[info] ------- Jacoco Coverage Report --------
[info]
[info] Lines: 57.5% (>= required 0.0%) covered, 34 of 80 missed, OK
[info] Instructions: 71.94% (>= required 0.0%) covered, 523 of 1864 missed, OK
[info] Branches: 27.78% (>= required 0.0%) covered, 26 of 36 missed, OK
[info] Methods: 81.94% (>= required 0.0%) covered, 41 of 227 missed, OK
[info] Complexity: 76.73% (>= required 0.0%) covered, 57 of 245 missed, OK
[info] Class: 57.14% (>= required 0.0%) covered, 12 of 28 missed, OK
[info] Check /Users/jacek/sandbox/play-jacoco/target/scala-2.11/jacoco for detail report
[info]
[success] Total time: 4 s, completed Jul 11, 2014 8:01:00 PM
Here's the status of the project.
[play-jacoco] $ about
[info] This is sbt 0.13.5
[info] The current project is {file:/Users/jacek/sandbox/play-jacoco/}root 1.0-SNAPSHOT
[info] The current project is built against Scala 2.11.1
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, play.Play, play.PlayJava, play.PlayScala, play.twirl.sbt.SbtTwirl, com.typesafe.sbt.jse.SbtJsEngine, com.typesafe.sbt.jse.SbtJsTask, com.typesafe.sbt.web.SbtWeb, com.typesafe.sbt.webdriver.SbtWebDriver, com.typesafe.sbt.coffeescript.SbtCoffeeScript, com.typesafe.sbt.less.SbtLess, com.typesafe.sbt.jshint.SbtJSHint, com.typesafe.sbt.rjs.SbtRjs, com.typesafe.sbt.digest.SbtDigest, com.typesafe.sbt.mocha.SbtMocha, net.virtualvoid.sbt.graph.Plugin, com.timushev.sbt.updates.UpdatesPlugin, com.typesafe.sbteclipse.plugin.EclipsePlugin, org.sbtidea.SbtIdeaPlugin, com.typesafe.sbt.SbtNativePackager, de.johoop.jacoco4sbt.JacocoPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.10.4
You have to remove following line.
testOptions in jacoco.Config += Tests.Argument("junitxml")
This is not supported opiton. For the list of supported options check the documentation
I'm using IntelliJ for Android development. I'm using this project as a test project to make android app run on Genymotion:
https://github.com/nicokruger/android-maven-phonegap
I am able to run
$mvn android:dex
$mvn android:apk
However
$mvn android:emulator-start fails
[INFO] Found 1 devices connected with the Android Debug Bridge
[INFO] Starting android emulator with script: /tmp/android-maven-plugin-emulator-start.sh
[INFO] Waiting for emulator start:5000
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.673 s
[INFO] Finished at: 2014-04-01T11:48:03+08:00
[INFO] Final Memory: 12M/310M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:emulator-start (default-cli) on project test: MojoExecutionException: Timeout while waiting for emulator to startup. -> [Help 1]
This plugin is not meant to run non-SDK emulator. Plugin search for emulator executable under following path (as it can be found in code):
String emulatorPath = new File (
getAndroidSdk().getToolsPath(), parsedExecutable ).getAbsolutePath();
Is there any way I can run Maven project in Netbeans not in a Maven way? Netbeans do it automatically but I just want to run program normally, as a typical Java project (to save time). I want output to look like this:
run:
Hello world!
BUILD SUCCESSFUL (total time: 0 seconds)
instead of this:
cd C:\Users\mbrnw_000\Documents\NetBeansProjects\mavenproject1; "JAVA_HOME=C:\\Program Files\\Java\\jdk1.7.0_15" "\"C:\\Program Files\\NetBeans 7.3\\java\\maven\\bin\\mvn.bat\"" "-Dexec.args=-classpath %classpath pl.mbrnwsk.mavenproject1.App" "-Dexec.executable=C:\\Program Files\\Java\\jdk1.7.0_15\\bin\\java.exe" process-classes org.codehaus.mojo:exec-maven-plugin:1.2.1:exec
Scanning for projects...
------------------------------------------------------------------------
Building mavenproject1 1.0-SNAPSHOT
------------------------------------------------------------------------
[resources:resources]
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory C:\Users\mbrnw_000\Documents\NetBeansProjects\mavenproject1\src\main\resources
[compiler:compile]
Nothing to compile - all classes are up to date
[exec:exec]
Hello world!
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 1.143s
Finished at: Fri May 03 16:27:09 CEST 2013
Final Memory: 6M/107M
------------------------------------------------------------------------
by turning on Compile on Save in project properties. However please note that in 7.4 (upcoming version) all execution will already be done by Maven exclusively.