Hello,
I'm exploring Maven and hence started to work with a simple web
application. I used the one I had already (mywebapp)
with the following directory structure.
mywebapp/
login.html
wEB-INF/
src/LoginServlet.java
src/EmailServlet.java
web.xml
I used to manually compile my sources and copy them to
WEB-INF/classes/mywebapp The application works well with tomcat.
Enter Maven and what a nightmare! I haven't used any tool that is as
complicated as Maven! You may all diagree (since you know maven) but
for firsttime users, this is useless.
I installed Maven and compiled the Hello World test application successfully.
Then I created a webapp archetype,
$ mvn archetype:generate -DgroupId=mywebapp -DartifactId=mywebapp
-DpackageName=mywebapp -DarchetypeArtifactId=maven-archetype-webapp
-Dversion=1.0.0
(oh yeah, it complains that "create" is deprecated and to use
"generate"... while there is no mention of this anywhere online)
I copied my source to resources/, and web.xml to the WEB-INF/
Here's my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>mywebapp</groupId>
<artifactId>mywebapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>poc Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>LoginServlet</finalName>
</build>
</project>
And when I run mvn compile, I get
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building mywebapp Maven Webapp
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:compile]
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Dec 16 14:15:55 IST 2008
[INFO] Final Memory: 6M/86M
[INFO] -----------------------------
So I'm not sure where to go from here. Most examples never talk about
the compile process and what happens during this phase. I have looked
plenty online for help and clues but found none to be useful. The
maven documentation itself is complicated.
Why isn't there a simple webapplication example using maven?. No i
don't want to use Jetty. I just want to compile a war file and deploy
it on tomcat (manually).
Sorry for venting. Ant is so much better in simplicity. But I don't
want to use Ant tasks in Maven since my application will grow to be
complex and I want to use Maven as advertised but the learning curve
sucks!
Joey
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]