I'm about to create a new maven project and came across this interesting guide https://vaadin.com/wiki/-/wiki/Main/Creating%20a%20simple%20component Now, I have a couple of question about getting this to work with a maven project as there seem to be some differences in the way things are handled.
When I create a maven project I don't get the same structure described at the end of the article:
com.example.mycomponent MyComponent.java MyComponentWidgetset.gwt.xml com.example.mycomponent.client MyComponentConnector.java MyComponentWidget.java
Is that normal? Does it mean that I have to modify my structure in maven?
They don't seem to be talking about the pom.xml file but web.xml, are they the same thing?
Generally speaking, what I wanted to do was to create a new maven project and follow this tutorial
Vaadin and Maven are two different things.
Vaadin is a Java framework for building modern web applications, which you can then import in the Maven project via the POM.xml:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>7.6.6</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>7.6.6</version>
</dependency>
<!-- Optional for extending client-side See: https://vaadin.com/book/-/page/clientside.html
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>7.6.6</version>
<scope>provided</scope>
</dependency>
-->
<!-- Optional for optimizing client-side widgets See: https://vaadin.com/book/-/page/mobile.optimization.html
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>7.6.6</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>7.6.6</version>
</dependency>
<!-- Optional push support for communication See: https://vaadin.com/book/-/page/advanced.push.html
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-push</artifactId>
<version>7.6.6</version>
</dependency>
-->
Source https://vaadin.com/maven#dependencies
To then create a Vaadin project with Maven, check this tutorial
Maven's primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. In order to attain this goal there are several areas of concern that Maven attempts to deal with:
Making the build process easy
Providing a uniform build system
Providing quality project information
Providing guidelines for best practices development
Allowing transparent migration to new features
Source: maven
The provided link is not describing about Maven project it's just how to do in java. But that dosen't mean you cannot use Maven.
In maven the project structure will be as follows for a web application
Project Root
|
+-pom.xml
+-src
+-main
+-java
+-resources
+-webapp
+-WEB-INF
+-web.xml
pom.xml
is where you define the project details like group id, artifact id and version along with project dependencies (in your case Vaadin dependencies). src\\main\\java
folder will have your java files. src\\main\\resources
folder will have non java files those you need in the classpath. src\\main\\webapp
folder will have the web resources like html, css javascript etc along with WEB-INF
folder. So your project structure will be
Project Root
|
+-pom.xml
+-src
+-main
+-java
| +-com
| +-example
| +-mycomponent
| +-MyComponent.java
| +-client
| +-MyComponentConnector.java
| +-MyComponentWidget.java
+-resources
| +-com
| +-example
| +-mycomponent
| +MyComponentWidgetset.gwt.xml
+-webapp
+-WEB-INF
+-web.xml
For your question on is pom.xml and web.xml is same? it's not pom.xml is for maven project object model and the web.xml is web deployment descriptor.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.