You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Joey Krane <li...@gmail.com> on 2008/12/16 10:17:24 UTC
Maven webapp and extreme complexity
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven webapp and extreme complexity
Posted by Martin Höller <ma...@xss.co.at>.
On Tuesday 16 December 2008 Joey Krane wrote:
> On Tue, Dec 16, 2008 at 3:28 PM, Nick Stolwijk <ni...@gmail.com>
wrote:
> > Take a look at chapter 5 of the book. It creates a simple webapp. In
> > chapter 5.5 it adds a servlet to src/main/java.
>
> Thanks for your patience. Creating the java directory and copying the
> sources fixed the problem.
Good.
> I think it is a bug in the webapp archetype that java directory isn't
> created.
No, it's not. As Nick mentioned earlier, it's best practice to separate your
java sources from the webapp into a module of its own. That's why the java
dir is not there: to follow the best practice.
hth,
- martin
Re: Maven webapp and extreme complexity
Posted by Joey Krane <li...@gmail.com>.
On Tue, Dec 16, 2008 at 3:28 PM, Nick Stolwijk <ni...@gmail.com> wrote:
> Take a look at chapter 5 of the book. It creates a simple webapp. In
> chapter 5.5 it adds a servlet to src/main/java.
>
Thanks for your patience. Creating the java directory and copying the
sources fixed the problem.
I think it is a bug in the webapp archetype that java directory isn't created.
Thanks for the link to the book. It all makes sense now :-)
Joey
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven webapp and extreme complexity
Posted by Nick Stolwijk <ni...@gmail.com>.
Take a look at chapter 5 of the book. It creates a simple webapp. In
chapter 5.5 it adds a servlet to src/main/java.
Hth,
Nick Stolwijk
~Java Developer~
Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl
On Tue, Dec 16, 2008 at 10:56 AM, Nick Stolwijk <ni...@gmail.com> wrote:
> You created your project with the sample webapp as archetype. It is
> recommended to seperate your java files and your webapp in seperate
> modules and add a dependency between the modules. For your first maven
> project you can simply create the src/main/java yourself (it is just a
> directory) and put your java files in there.
>
> Hth,
>
> Nick Stolwijk
> ~Java Developer~
>
> Iprofs BV.
> Claus Sluterweg 125
> 2012 WS Haarlem
> www.iprofs.nl
>
>
>
> On Tue, Dec 16, 2008 at 10:52 AM, Joey Krane <li...@gmail.com> wrote:
>> Thanks for the response.
>>
>> On Tue, Dec 16, 2008 at 3:03 PM, Nick Stolwijk <ni...@gmail.com> wrote:
>>> Maven is not that much more difficult then ant, it is different.
>>>
>>> Please take a look at the maven book [1], this explains everything in
>>> a very good way!
>>
>> Yes, I did refer to this as well. It does not talk about an end to end
>> web application example or for moving from ant to maven in web
>> application context.
>>
>>>
>>> Oh, and for your compile problem. Put your java sources in
>>> src/main/java,
>>
>> I don't see src/main/java but only src/main/resources and src/main/webapp
>>
>>> your resources in src/main/resources,
>>
>> Is resources the same as my source code? If so, I tried that and I
>> still get No resources to compile .. or something similar.
>>
>>> your unit tests
>>
>> I haven't gone that far yet. I'm still struggling to get a simple
>> webapplication to compile and create a war file.
>>
>> Joey
>>
>>
>>>
>>>
>>>
>>> On Tue, Dec 16, 2008 at 10:17 AM, Joey Krane <li...@gmail.com> wrote:
>>>> 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: users-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: users-help@maven.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven webapp and extreme complexity
Posted by Nick Stolwijk <ni...@gmail.com>.
You created your project with the sample webapp as archetype. It is
recommended to seperate your java files and your webapp in seperate
modules and add a dependency between the modules. For your first maven
project you can simply create the src/main/java yourself (it is just a
directory) and put your java files in there.
Hth,
Nick Stolwijk
~Java Developer~
Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl
On Tue, Dec 16, 2008 at 10:52 AM, Joey Krane <li...@gmail.com> wrote:
> Thanks for the response.
>
> On Tue, Dec 16, 2008 at 3:03 PM, Nick Stolwijk <ni...@gmail.com> wrote:
>> Maven is not that much more difficult then ant, it is different.
>>
>> Please take a look at the maven book [1], this explains everything in
>> a very good way!
>
> Yes, I did refer to this as well. It does not talk about an end to end
> web application example or for moving from ant to maven in web
> application context.
>
>>
>> Oh, and for your compile problem. Put your java sources in
>> src/main/java,
>
> I don't see src/main/java but only src/main/resources and src/main/webapp
>
>> your resources in src/main/resources,
>
> Is resources the same as my source code? If so, I tried that and I
> still get No resources to compile .. or something similar.
>
>> your unit tests
>
> I haven't gone that far yet. I'm still struggling to get a simple
> webapplication to compile and create a war file.
>
> Joey
>
>
>>
>>
>>
>> On Tue, Dec 16, 2008 at 10:17 AM, Joey Krane <li...@gmail.com> wrote:
>>> 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: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven webapp and extreme complexity
Posted by Joey Krane <li...@gmail.com>.
Thanks for the response.
On Tue, Dec 16, 2008 at 3:03 PM, Nick Stolwijk <ni...@gmail.com> wrote:
> Maven is not that much more difficult then ant, it is different.
>
> Please take a look at the maven book [1], this explains everything in
> a very good way!
Yes, I did refer to this as well. It does not talk about an end to end
web application example or for moving from ant to maven in web
application context.
>
> Oh, and for your compile problem. Put your java sources in
> src/main/java,
I don't see src/main/java but only src/main/resources and src/main/webapp
> your resources in src/main/resources,
Is resources the same as my source code? If so, I tried that and I
still get No resources to compile .. or something similar.
> your unit tests
I haven't gone that far yet. I'm still struggling to get a simple
webapplication to compile and create a war file.
Joey
>
>
>
> On Tue, Dec 16, 2008 at 10:17 AM, Joey Krane <li...@gmail.com> wrote:
>> 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: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven webapp and extreme complexity
Posted by Nick Stolwijk <ni...@gmail.com>.
And you are completely right. :) Thanks, a quick c/p error.
With regards,
Nick Stolwijk
~Java Developer~
Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl
On Tue, Dec 16, 2008 at 10:38 AM, Martin Höller <ma...@xss.co.at> wrote:
> On Tuesday 16 December 2008 Nick Stolwijk wrote:
>> Maven is not that much more difficult then ant, it is different.
>>
>> Please take a look at the maven book [1], this explains everything in
>> a very good way!
>>
>> Oh, and for your compile problem. Put your java sources in
>> src/main/java, your resources in src/main/resources, your unit tests
>> in src/test/java/ en your unit test resources in src/test/java.
> ^^^^
> There's a typo: test-resources should go in src/test/resources, not
> src/test/java.
>
> hth,
> - martin
>
Re: Maven webapp and extreme complexity
Posted by Martin Höller <ma...@xss.co.at>.
On Tuesday 16 December 2008 Nick Stolwijk wrote:
> Maven is not that much more difficult then ant, it is different.
>
> Please take a look at the maven book [1], this explains everything in
> a very good way!
>
> Oh, and for your compile problem. Put your java sources in
> src/main/java, your resources in src/main/resources, your unit tests
> in src/test/java/ en your unit test resources in src/test/java.
^^^^
There's a typo: test-resources should go in src/test/resources, not
src/test/java.
hth,
- martin
Re: Maven webapp and extreme complexity
Posted by Nick Stolwijk <ni...@gmail.com>.
Maven is not that much more difficult then ant, it is different.
Please take a look at the maven book [1], this explains everything in
a very good way!
Oh, and for your compile problem. Put your java sources in
src/main/java, your resources in src/main/resources, your unit tests
in src/test/java/ en your unit test resources in src/test/java. These
are the default directories for maven.
Hth,
[1] http://books.sonatype.com/maven-book/index.html
Nick Stolwijk
~Java Developer~
Iprofs BV.
Claus Sluterweg 125
2012 WS Haarlem
www.iprofs.nl
On Tue, Dec 16, 2008 at 10:17 AM, Joey Krane <li...@gmail.com> wrote:
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org