1

When creating a new Vaadin 8.1.0 app named bogus using the archetype vaadin-archetype-application-multimodule, the build fails in IntelliJ 2017.2 when running Maven Projects panel > bogus-ui > Plugins > jetty > jetty:run

enter image description here

I get these error messages on console.

/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/basilbourque/IdeaProjects/bogus/bogus-ui "-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55637:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2017.2 org.eclipse.jetty:jetty-maven-plugin:9.3.9.v20160517:run
objc[11304]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java (0x1060bd4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10712c4e0). One of the two will be used. Which one is undefined.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building bogus-ui 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:9.3.9.v20160517:run (default-cli) > test-compile @ bogus-ui >>>
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.pom
[WARNING] The POM for com.example:bogus-backend:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/com/example/bogus-backend/1.0-SNAPSHOT/bogus-backend-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.334 s
[INFO] Finished at: 2017-07-30T22:58:18-07:00
[INFO] Final Memory: 11M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project bogus-ui: Could not resolve dependencies for project com.example:bogus-ui:war:1.0-SNAPSHOT: Could not find artifact com.example:bogus-backend:jar:1.0-SNAPSHOT in vaadin-addons (http://maven.vaadin.com/vaadin-addons) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Process finished with exit code 1

Using Java 8 Update 144 on macOS Sierra 10.12.5 with IntelliJ Ultimate edition 2017.2.

The linked Question, Maven: How to use jetty:run in a multi-module Maven project, without needing to install, is not a duplicate of this Question. That one asks about one module (the Web Module) picking up on changes made in other modules and causing a rebuild rather than retrieving built items from local repository. I am asking how to run the app in the first place, long before needing to trigger re-builds.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • Possible duplicate of [Maven: How to use jetty:run in a multi-module Maven project, without needing to install](https://stackoverflow.com/questions/4371373/maven-how-to-use-jettyrun-in-a-multi-module-maven-project-without-needing-to) – Morfic Jul 31 '17 at 08:57
  • @Morfic Not a duplicate, but [that other Question](https://stackoverflow.com/questions/4371373/maven-how-to-use-jettyrun-in-a-multi-module-maven-project-without-needing-to) is very interesting and helpful, thanks. So too [this one on multimodule Maven best practices](https://stackoverflow.com/q/10686682/642706). – Basil Bourque Jul 31 '17 at 18:17
  • No problem. I take it you ran `mvn install` on the parent and then `mvn jetty:run` and you're still having the same issue? – Morfic Jul 31 '17 at 18:32
  • @Morfic Working now. Running a `Lifecycle` > `install` on the root/parent module did the trick, followed by `Plugins` > `Jetty:run` to run the Vaadin app. I edited and accepted Answer here. Next step is to learn how to properly run the Vaadin web app from IntelliJ as I read that `Jetty:run` is for meant for convenience but not best for daily incremental development work. – Basil Bourque Aug 01 '17 at 21:37
  • Cool, but I feel that it's still a duplicate of the mentioned question because the idea is the same. To run your your module which depends on the others, you need to install all those dependencies in your local repo, instead of jetty picking them up (or their classes) based on your maven project structure. Furthermore, as you said, once you make changes, you'll have to reinstall the updated module (or all of them if there are changes across multiple modules). Whether it's in the initial phase of the project or at a later time, you still need to run `install` first, but that's only my opinion. – Morfic Aug 02 '17 at 07:16

2 Answers2

2

Lifecycle > install on root/parent module

Maven needs to find dependencies before running.

You need to run 'mvn install' on root (parent) project or on your backend module (and other project that backend depends on).

enter image description here

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
wargre
  • 4,575
  • 1
  • 19
  • 35
1

you need to run mvn clean install command on the the parent project from root directory>

Mayank Sharma
  • 403
  • 2
  • 2