You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by sp4rc <sa...@gmx.net> on 2007/08/29 18:07:43 UTC

ant, maven and creating war's

Hello listmembers, 

I am new to all this java webapplication stuff, but I hope you can help
me to get into this great technologies.

So far I have got my tomcat server (5.5.23-r6) up and runnig,
struts-2.0.9 is on my system (gentoo-linux) and I was able to deploy the
sample war "blank" ([1] tree output). Now I would like to follow the
struts tutorial [2] and create my own war file from scratch... 

But the problem is, that simply don't know how to create a war file
using ant or even maven. Can you point me to the right direction? 

What is this MANIFEST.MF about? 

Does ant or maven compile any sourcecode, or is it just packin the files
and the servlet-container compiles the first time it gets run? 

How does the filestructure of my sources have to look like befor using
[ant|maven]? 

Regs
/sp4rc

[1]
/var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9
|-- META-INF
|   |-- MANIFEST.MF
|   `-- maven
|       `-- org.apache.struts
|           `-- struts2-blank
|               |-- pom.properties
|               `-- pom.xml
|-- WEB-INF
|   |-- classes
|   |   |-- LICENSE.txt
|   |   |-- NOTICE.txt
|   |   |-- example
|   |   |   |-- ExampleSupport.class
|   |   |   |-- HelloWorld.class
|   |   |   |-- Login-validation.xml
|   |   |   |-- Login.class
|   |   |   |-- package.properties
|   |   |   `-- package_es.properties
|   |   |-- example.xml
|   |   `-- struts.xml
|   |-- lib
|   |   |-- commons-logging-1.0.4.jar
|   |   |-- freemarker-2.3.8.jar
|   |   |-- ognl-2.6.11.jar
|   |   |-- struts2-core-2.0.9.jar
|   |   `-- xwork-2.0.4.jar
|   |-- src
|   |   `-- java
|   |       |-- LICENSE.txt
|   |       |-- NOTICE.txt
|   |       |-- example
|   |       |   |-- ExampleSupport.java
|   |       |   |-- HelloWorld.java
|   |       |   |-- Login-validation.xml
|   |       |   |-- Login.java
|   |       |   |-- build.bat
|   |       |   |-- package.properties
|   |       |   `-- package_es.properties
|   |       |-- example.xml
|   |       `-- struts.xml
|   `-- web.xml
|-- example
|   |-- HelloWorld.jsp
|   |-- Login.jsp
|   |-- Menu.jsp
|   |-- Missing.jsp
|   |-- Register.jsp
|   `-- Welcome.jsp
`-- index.html

[2] http://struts.apache.org/2.x/docs/simple-setup.html



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[OT] Re: ant, maven and creating war's

Posted by nuwan chandrasoma <my...@gmail.com>.
Hi,

Just google it, here are some of the links that may be useful to you

http://www.roseindia.net/jboss/buildingwebapplicationwithant.shtml

http://www.onjava.com/pub/a/onjava/2003/01/08/tomcat4.html?page=1

Thanks,

Nuwan

On 8/29/07, sp4rc <sa...@gmx.net> wrote:
>
> Hello listmembers,
>
> I am new to all this java webapplication stuff, but I hope you can help
> me to get into this great technologies.
>
> So far I have got my tomcat server (5.5.23-r6) up and runnig,
> struts-2.0.9 is on my system (gentoo-linux) and I was able to deploy the
> sample war "blank" ([1] tree output). Now I would like to follow the
> struts tutorial [2] and create my own war file from scratch...
>
> But the problem is, that simply don't know how to create a war file
> using ant or even maven. Can you point me to the right direction?
>
> What is this MANIFEST.MF about?
>
> Does ant or maven compile any sourcecode, or is it just packin the files
> and the servlet-container compiles the first time it gets run?
>
> How does the filestructure of my sources have to look like befor using
> [ant|maven]?
>
> Regs
> /sp4rc
>
> [1]
> /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9
> |-- META-INF
> |   |-- MANIFEST.MF
> |   `-- maven
> |       `-- org.apache.struts
> |           `-- struts2-blank
> |               |-- pom.properties
> |               `-- pom.xml
> |-- WEB-INF
> |   |-- classes
> |   |   |-- LICENSE.txt
> |   |   |-- NOTICE.txt
> |   |   |-- example
> |   |   |   |-- ExampleSupport.class
> |   |   |   |-- HelloWorld.class
> |   |   |   |-- Login-validation.xml
> |   |   |   |-- Login.class
> |   |   |   |-- package.properties
> |   |   |   `-- package_es.properties
> |   |   |-- example.xml
> |   |   `-- struts.xml
> |   |-- lib
> |   |   |-- commons-logging-1.0.4.jar
> |   |   |-- freemarker-2.3.8.jar
> |   |   |-- ognl-2.6.11.jar
> |   |   |-- struts2-core-2.0.9.jar
> |   |   `-- xwork-2.0.4.jar
> |   |-- src
> |   |   `-- java
> |   |       |-- LICENSE.txt
> |   |       |-- NOTICE.txt
> |   |       |-- example
> |   |       |   |-- ExampleSupport.java
> |   |       |   |-- HelloWorld.java
> |   |       |   |-- Login-validation.xml
> |   |       |   |-- Login.java
> |   |       |   |-- build.bat
> |   |       |   |-- package.properties
> |   |       |   `-- package_es.properties
> |   |       |-- example.xml
> |   |       `-- struts.xml
> |   `-- web.xml
> |-- example
> |   |-- HelloWorld.jsp
> |   |-- Login.jsp
> |   |-- Menu.jsp
> |   |-- Missing.jsp
> |   |-- Register.jsp
> |   `-- Welcome.jsp
> `-- index.html
>
> [2] http://struts.apache.org/2.x/docs/simple-setup.html
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: ant, maven and creating war's

Posted by Jim Cushing <ji...@mac.com>.
Have you checked out the Bootstrap Tutorial yet? It gives you a great  
intro to Struts 2, and a bit of Maven 2 at the same time.

http://struts.apache.org/2.x/docs/bootstrap.html

Ian Roughley has put out a book, which you can download for free  
(though I'm sure he'd love it if you purchased a printed copy),  
called Starting Struts 2.

http://www.infoq.com/minibooks/starting-struts2

On Aug 29, 2007, at 2:34 PM, sp4rc wrote:

> Thanks for the input. I think I will have to start with the total  
> basics
> before moving on to struts. Anyhow I googled for any tutorials,  
> sources
> I just got more and more frustrated, as I just dont know where to  
> start.
> Has anyone a got starting point, link, etc. for me?
>
> On Wed, 2007-08-29 at 13:20 -0400, Jim Cushing wrote:
>> I haven't touched Ant in years, so I can't help you much there, but
>> with Maven 2, it's as simple as running 'mvn package'. The POM itself
>> says whether the project produces a JAR, WAR, or some other artifact,
>> so package always builds the appropriate artifact for the project.
>> For a web app, that is of course a WAR, for something else, it may be
>> a JAR.
>>
>> For development, you might want to try using Jetty instead of Tomcat,
>> because Maven 2 has a plugin that makes this really simple. Add the
>> following to your POM:
>>
>>      	<plugins>
>>      		<plugin>
>>      			<groupId>org.mortbay.jetty</groupId>
>>      			<artifactId>maven-jetty-plugin</artifactId>
>>      			<version>6.1.5</version>
>>      			<configuration>
>>      				<scanIntervalSeconds>10</scanIntervalSeconds>
>> 		          <connectors>
>> 		            <connector
>> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
>> 		              <port>7171</port>
>> 		            </connector>
>> 		            </connectors>
>>      			</configuration>
>>      		</plugin>
>>      	</plugins>
>>
>> You can set the port to whatever you want (7171 in this example),
>> just make sure it doesn't conflict with anything else you have  
>> running.
>>
>> Then, run 'mvn jetty:run', and a Jetty server will fire up. Nothing
>> to install.
>>
>> Go to http://localhost:7171/ in a browser, and you'll see a link to
>> your application.
>>
>> Now, the really fun part begins: Make changes to your application.
>> Edit your pages, your actions, and your configuration, and Jetty will
>> pick up those changes without you having to rebuild. Changes to your
>> Java code or configuration will cause Jetty to restart your web app,
>> automatically, though it may take several seconds. Page changes, of
>> course, are picked up without a restart.
>>
>> Sometimes, I'll find that Jetty does hang on me and ctrl-c won't kill
>> the maven/jetty process. If that's the case, just hit ctrl-z to put
>> it in the background, 'ps' to get the PID, and 'kill -9 <pid>' to
>> force it to quit. Run 'mvn jetty:run' again. But even if you find
>> that happening to you 2-4 times a day, it's so much faster than
>> WARing it up and pushing it to Tomcat. Plus, anyone on your team can
>> use this same command, as they don't have to install or configure
>> Tomcat.
>>
>> On Aug 29, 2007, at 12:07 PM, sp4rc wrote:
>>
>>> Hello listmembers,
>>>
>>> I am new to all this java webapplication stuff, but I hope you can
>>> help
>>> me to get into this great technologies.
>>>
>>> So far I have got my tomcat server (5.5.23-r6) up and runnig,
>>> struts-2.0.9 is on my system (gentoo-linux) and I was able to
>>> deploy the
>>> sample war "blank" ([1] tree output). Now I would like to follow the
>>> struts tutorial [2] and create my own war file from scratch...
>>>
>>> But the problem is, that simply don't know how to create a war file
>>> using ant or even maven. Can you point me to the right direction?
>>>
>>> What is this MANIFEST.MF about?
>>>
>>> Does ant or maven compile any sourcecode, or is it just packin the
>>> files
>>> and the servlet-container compiles the first time it gets run?
>>>
>>> How does the filestructure of my sources have to look like befor  
>>> using
>>> [ant|maven]?
>>>
>>> Regs
>>> /sp4rc
>>>
>>> [1]
>>> /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9
>>> |-- META-INF
>>> |   |-- MANIFEST.MF
>>> |   `-- maven
>>> |       `-- org.apache.struts
>>> |           `-- struts2-blank
>>> |               |-- pom.properties
>>> |               `-- pom.xml
>>> |-- WEB-INF
>>> |   |-- classes
>>> |   |   |-- LICENSE.txt
>>> |   |   |-- NOTICE.txt
>>> |   |   |-- example
>>> |   |   |   |-- ExampleSupport.class
>>> |   |   |   |-- HelloWorld.class
>>> |   |   |   |-- Login-validation.xml
>>> |   |   |   |-- Login.class
>>> |   |   |   |-- package.properties
>>> |   |   |   `-- package_es.properties
>>> |   |   |-- example.xml
>>> |   |   `-- struts.xml
>>> |   |-- lib
>>> |   |   |-- commons-logging-1.0.4.jar
>>> |   |   |-- freemarker-2.3.8.jar
>>> |   |   |-- ognl-2.6.11.jar
>>> |   |   |-- struts2-core-2.0.9.jar
>>> |   |   `-- xwork-2.0.4.jar
>>> |   |-- src
>>> |   |   `-- java
>>> |   |       |-- LICENSE.txt
>>> |   |       |-- NOTICE.txt
>>> |   |       |-- example
>>> |   |       |   |-- ExampleSupport.java
>>> |   |       |   |-- HelloWorld.java
>>> |   |       |   |-- Login-validation.xml
>>> |   |       |   |-- Login.java
>>> |   |       |   |-- build.bat
>>> |   |       |   |-- package.properties
>>> |   |       |   `-- package_es.properties
>>> |   |       |-- example.xml
>>> |   |       `-- struts.xml
>>> |   `-- web.xml
>>> |-- example
>>> |   |-- HelloWorld.jsp
>>> |   |-- Login.jsp
>>> |   |-- Menu.jsp
>>> |   |-- Missing.jsp
>>> |   |-- Register.jsp
>>> |   `-- Welcome.jsp
>>> `-- index.html
>>>
>>> [2] http://struts.apache.org/2.x/docs/simple-setup.html
>>>
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ant, maven and creating war's

Posted by sp4rc <sa...@gmx.net>.
Thanks for the input. I think I will have to start with the total basics
before moving on to struts. Anyhow I googled for any tutorials, sources
I just got more and more frustrated, as I just dont know where to start.
Has anyone a got starting point, link, etc. for me?

On Wed, 2007-08-29 at 13:20 -0400, Jim Cushing wrote:
> I haven't touched Ant in years, so I can't help you much there, but  
> with Maven 2, it's as simple as running 'mvn package'. The POM itself  
> says whether the project produces a JAR, WAR, or some other artifact,  
> so package always builds the appropriate artifact for the project.  
> For a web app, that is of course a WAR, for something else, it may be  
> a JAR.
> 
> For development, you might want to try using Jetty instead of Tomcat,  
> because Maven 2 has a plugin that makes this really simple. Add the  
> following to your POM:
> 
>      	<plugins>
>      		<plugin>
>      			<groupId>org.mortbay.jetty</groupId>
>      			<artifactId>maven-jetty-plugin</artifactId>
>      			<version>6.1.5</version>
>      			<configuration>
>      				<scanIntervalSeconds>10</scanIntervalSeconds>
> 		          <connectors>
> 		            <connector  
> implementation="org.mortbay.jetty.nio.SelectChannelConnector">
> 		              <port>7171</port>
> 		            </connector>
> 		            </connectors>
>      			</configuration>
>      		</plugin>
>      	</plugins>
> 
> You can set the port to whatever you want (7171 in this example),  
> just make sure it doesn't conflict with anything else you have running.
> 
> Then, run 'mvn jetty:run', and a Jetty server will fire up. Nothing  
> to install.
> 
> Go to http://localhost:7171/ in a browser, and you'll see a link to  
> your application.
> 
> Now, the really fun part begins: Make changes to your application.  
> Edit your pages, your actions, and your configuration, and Jetty will  
> pick up those changes without you having to rebuild. Changes to your  
> Java code or configuration will cause Jetty to restart your web app,  
> automatically, though it may take several seconds. Page changes, of  
> course, are picked up without a restart.
> 
> Sometimes, I'll find that Jetty does hang on me and ctrl-c won't kill  
> the maven/jetty process. If that's the case, just hit ctrl-z to put  
> it in the background, 'ps' to get the PID, and 'kill -9 <pid>' to  
> force it to quit. Run 'mvn jetty:run' again. But even if you find  
> that happening to you 2-4 times a day, it's so much faster than  
> WARing it up and pushing it to Tomcat. Plus, anyone on your team can  
> use this same command, as they don't have to install or configure  
> Tomcat.
> 
> On Aug 29, 2007, at 12:07 PM, sp4rc wrote:
> 
> > Hello listmembers,
> >
> > I am new to all this java webapplication stuff, but I hope you can  
> > help
> > me to get into this great technologies.
> >
> > So far I have got my tomcat server (5.5.23-r6) up and runnig,
> > struts-2.0.9 is on my system (gentoo-linux) and I was able to  
> > deploy the
> > sample war "blank" ([1] tree output). Now I would like to follow the
> > struts tutorial [2] and create my own war file from scratch...
> >
> > But the problem is, that simply don't know how to create a war file
> > using ant or even maven. Can you point me to the right direction?
> >
> > What is this MANIFEST.MF about?
> >
> > Does ant or maven compile any sourcecode, or is it just packin the  
> > files
> > and the servlet-container compiles the first time it gets run?
> >
> > How does the filestructure of my sources have to look like befor using
> > [ant|maven]?
> >
> > Regs
> > /sp4rc
> >
> > [1]
> > /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9
> > |-- META-INF
> > |   |-- MANIFEST.MF
> > |   `-- maven
> > |       `-- org.apache.struts
> > |           `-- struts2-blank
> > |               |-- pom.properties
> > |               `-- pom.xml
> > |-- WEB-INF
> > |   |-- classes
> > |   |   |-- LICENSE.txt
> > |   |   |-- NOTICE.txt
> > |   |   |-- example
> > |   |   |   |-- ExampleSupport.class
> > |   |   |   |-- HelloWorld.class
> > |   |   |   |-- Login-validation.xml
> > |   |   |   |-- Login.class
> > |   |   |   |-- package.properties
> > |   |   |   `-- package_es.properties
> > |   |   |-- example.xml
> > |   |   `-- struts.xml
> > |   |-- lib
> > |   |   |-- commons-logging-1.0.4.jar
> > |   |   |-- freemarker-2.3.8.jar
> > |   |   |-- ognl-2.6.11.jar
> > |   |   |-- struts2-core-2.0.9.jar
> > |   |   `-- xwork-2.0.4.jar
> > |   |-- src
> > |   |   `-- java
> > |   |       |-- LICENSE.txt
> > |   |       |-- NOTICE.txt
> > |   |       |-- example
> > |   |       |   |-- ExampleSupport.java
> > |   |       |   |-- HelloWorld.java
> > |   |       |   |-- Login-validation.xml
> > |   |       |   |-- Login.java
> > |   |       |   |-- build.bat
> > |   |       |   |-- package.properties
> > |   |       |   `-- package_es.properties
> > |   |       |-- example.xml
> > |   |       `-- struts.xml
> > |   `-- web.xml
> > |-- example
> > |   |-- HelloWorld.jsp
> > |   |-- Login.jsp
> > |   |-- Menu.jsp
> > |   |-- Missing.jsp
> > |   |-- Register.jsp
> > |   `-- Welcome.jsp
> > `-- index.html
> >
> > [2] http://struts.apache.org/2.x/docs/simple-setup.html
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: ant, maven and creating war's

Posted by Jim Cushing <ji...@mac.com>.
I haven't touched Ant in years, so I can't help you much there, but  
with Maven 2, it's as simple as running 'mvn package'. The POM itself  
says whether the project produces a JAR, WAR, or some other artifact,  
so package always builds the appropriate artifact for the project.  
For a web app, that is of course a WAR, for something else, it may be  
a JAR.

For development, you might want to try using Jetty instead of Tomcat,  
because Maven 2 has a plugin that makes this really simple. Add the  
following to your POM:

     	<plugins>
     		<plugin>
     			<groupId>org.mortbay.jetty</groupId>
     			<artifactId>maven-jetty-plugin</artifactId>
     			<version>6.1.5</version>
     			<configuration>
     				<scanIntervalSeconds>10</scanIntervalSeconds>
		          <connectors>
		            <connector  
implementation="org.mortbay.jetty.nio.SelectChannelConnector">
		              <port>7171</port>
		            </connector>
		            </connectors>
     			</configuration>
     		</plugin>
     	</plugins>

You can set the port to whatever you want (7171 in this example),  
just make sure it doesn't conflict with anything else you have running.

Then, run 'mvn jetty:run', and a Jetty server will fire up. Nothing  
to install.

Go to http://localhost:7171/ in a browser, and you'll see a link to  
your application.

Now, the really fun part begins: Make changes to your application.  
Edit your pages, your actions, and your configuration, and Jetty will  
pick up those changes without you having to rebuild. Changes to your  
Java code or configuration will cause Jetty to restart your web app,  
automatically, though it may take several seconds. Page changes, of  
course, are picked up without a restart.

Sometimes, I'll find that Jetty does hang on me and ctrl-c won't kill  
the maven/jetty process. If that's the case, just hit ctrl-z to put  
it in the background, 'ps' to get the PID, and 'kill -9 <pid>' to  
force it to quit. Run 'mvn jetty:run' again. But even if you find  
that happening to you 2-4 times a day, it's so much faster than  
WARing it up and pushing it to Tomcat. Plus, anyone on your team can  
use this same command, as they don't have to install or configure  
Tomcat.

On Aug 29, 2007, at 12:07 PM, sp4rc wrote:

> Hello listmembers,
>
> I am new to all this java webapplication stuff, but I hope you can  
> help
> me to get into this great technologies.
>
> So far I have got my tomcat server (5.5.23-r6) up and runnig,
> struts-2.0.9 is on my system (gentoo-linux) and I was able to  
> deploy the
> sample war "blank" ([1] tree output). Now I would like to follow the
> struts tutorial [2] and create my own war file from scratch...
>
> But the problem is, that simply don't know how to create a war file
> using ant or even maven. Can you point me to the right direction?
>
> What is this MANIFEST.MF about?
>
> Does ant or maven compile any sourcecode, or is it just packin the  
> files
> and the servlet-container compiles the first time it gets run?
>
> How does the filestructure of my sources have to look like befor using
> [ant|maven]?
>
> Regs
> /sp4rc
>
> [1]
> /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9
> |-- META-INF
> |   |-- MANIFEST.MF
> |   `-- maven
> |       `-- org.apache.struts
> |           `-- struts2-blank
> |               |-- pom.properties
> |               `-- pom.xml
> |-- WEB-INF
> |   |-- classes
> |   |   |-- LICENSE.txt
> |   |   |-- NOTICE.txt
> |   |   |-- example
> |   |   |   |-- ExampleSupport.class
> |   |   |   |-- HelloWorld.class
> |   |   |   |-- Login-validation.xml
> |   |   |   |-- Login.class
> |   |   |   |-- package.properties
> |   |   |   `-- package_es.properties
> |   |   |-- example.xml
> |   |   `-- struts.xml
> |   |-- lib
> |   |   |-- commons-logging-1.0.4.jar
> |   |   |-- freemarker-2.3.8.jar
> |   |   |-- ognl-2.6.11.jar
> |   |   |-- struts2-core-2.0.9.jar
> |   |   `-- xwork-2.0.4.jar
> |   |-- src
> |   |   `-- java
> |   |       |-- LICENSE.txt
> |   |       |-- NOTICE.txt
> |   |       |-- example
> |   |       |   |-- ExampleSupport.java
> |   |       |   |-- HelloWorld.java
> |   |       |   |-- Login-validation.xml
> |   |       |   |-- Login.java
> |   |       |   |-- build.bat
> |   |       |   |-- package.properties
> |   |       |   `-- package_es.properties
> |   |       |-- example.xml
> |   |       `-- struts.xml
> |   `-- web.xml
> |-- example
> |   |-- HelloWorld.jsp
> |   |-- Login.jsp
> |   |-- Menu.jsp
> |   |-- Missing.jsp
> |   |-- Register.jsp
> |   `-- Welcome.jsp
> `-- index.html
>
> [2] http://struts.apache.org/2.x/docs/simple-setup.html
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org