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 <linuxbsd2...@gmail.com> wrote:
> Thanks for the response.
>
> On Tue, Dec 16, 2008 at 3:03 PM, Nick Stolwijk <nick.stolw...@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 <linuxbsd2...@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-unsubscr...@maven.apache.org
>>> For additional commands, e-mail: users-h...@maven.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to