I have maven installed on an os x machine:
$ mvn --version
Apache Maven 3.2.3
Java version: 1.8.0_25,
vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"
I have tried several tutorials, looked around in SO:
- https://vaadin.com/book/-/page/getting-started.maven.html
- https://vaadin.com/wiki/-/wiki/Main/Creating+a+Maven+project
- http://www.maxpagels.com/tutorials/vaadin-tutorial/
- 404 Not Found Error in a simple Jetty/Maven Hello World webapp
But yet I can't setup a working Vaadin project runnable on the jetty maven plugin. My problem is that the project is not found on the jetty web server, I always get a 404 Not Found error.
Here are the steps I made:
$ cd ~
$ mkdir Maven
$ cd Maven
$ mvn archetype:generate \
-DarchetypeGroupId=com.vaadin \
-DarchetypeArtifactId=vaadin-archetype-application \
-DarchetypeVersion=7.3.9 \
-Dpackaging=war
...
[INFO] Archetype repository missing. Using the one from [com.vaadin:vaadin-archetype-application:7.3.9] found in catalog remote
Define value for property 'groupId': : com.example
Define value for property 'artifactId': : hello-world
Define value for property 'version': 1.0-SNAPSHOT: : 1.0
Define value for property 'package': com.example: :
[INFO] Using property: themeName = mytheme
[INFO] Using property: uiName = MyUI
[INFO] Using property: widgetsetName = MyAppWidgetset
Confirm properties configuration:
groupId: com.example
artifactId: hello-world
version: 1.0
package: com.example
themeName: mytheme
uiName: MyUI
widgetsetName: MyAppWidgetset
Y: : Y
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.332 s
[INFO] Finished at: 2015-01-27T12:03:42+03:00
[INFO] Final Memory: 15M/245M
[INFO] ------------------------------------------------------------------------
$ cd hello-world
$ mvn package
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:00 min
[INFO] Finished at: 2015-01-27T12:08:56+03:00
[INFO] Final Memory: 21M/247M
[INFO] ------------------------------------------------------------------------
$
Then I type the mvn jetty:run command:
$ mvn jetty:run
which gives this error:
Maven: No plugin found for prefix 'jetty' in the current project
So I add a settings.xml file inside ~/.m2 directory:
~/.m2/settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
</pluginGroups>
</settings>
And type mvn jetty:run again:
$ mvn jetty:run
...
[INFO] Configuring Jetty for project: hello-world-parent
[INFO] webAppSourceDirectory not set. Defaulting to /Users/me/Maven/hello-world/src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes directory /Users/me/Maven/hello-world/target/classes does not exist
[INFO] Context path = /
[INFO] Tmp directory = /Users/me/Maven/hello-world/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
[INFO] web.xml file = null
[INFO] Webapp directory = /Users/me/Maven/hello-world/src/main/webapp
2015-01-27 12:11:28.610:INFO:oejs.Server:jetty-8.1.16.v20140903
2015-01-27 12:11:29.121:INFO:oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
2015-01-27 12:11:31.038:WARN:oejsh.RequestLogHandler:!RequestLog
2015-01-27 12:11:31.155:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080
[INFO] Started Jetty Server
Now as you can see jetty starts, but when I open the browser at http://localhost:8080/, I get a 404 not found: Problem accessing /. Reason: Not Found
. I have either tried one of the following URLs:
- http://localhost:8080/
- http://localhost:8080
- http://localhost:8080/hello-world
- http://localhost:8080/hello-world/
- http://localhost:8080/hello-world-parent/
- http://localhost:8080/hello-world-parent
- http://localhost:8080/webapp
- http://localhost:8080/webapp/
No one worked for me (I always get a 404 not found).
Now, why they say in the documentation that if you follow the steps I have done above:
Book of Vaadin:
You can then open it in a web browser at http://localhost:8080/project-name.
project-name is the artifactId param given to the maven generate goal, and mine was artifactId: hello-world
, but as I said http://localhost:8080/hello-world didn't work for me (404 not found).
I am also reading the Vaadin 7 CookBook and here they say:
We are done and we can run our new web application. Go to the root of the project where pom.xml file is located and run the following command. mvn jetty:start The application will be running on http://localhost:8080
What??? http://localhost:8080
without the "project-name" suffix??? I have tried it, but still I get the 404 not found, anyway...
So please, is there someone that can explain me what is going on and how can I resolve this frustrating issue in order finally start developing with Vaadin?
Thank you for the attention.