You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kram <ma...@gmail.com> on 2007/10/05 09:16:30 UTC

Simple WAR file question

I have setup my app to use maven and it has a custom project directory
structure.

I had to configure the maven-war-plugin to control the output of resources,
jsp's etc... but it works.

The issue im having now is that inside the target directory, I have my WAR
file, but its contents are not the same as the directories in the target
directory.

For example, my target dir is like this:

target/PROJECT/common
target/PROJECT/webApp

but my WAR file only has the webApp dir as its root directory. I need it to
be one level up. So the root of the WAR file is the same as the PROJECT dir
of the target directory.

Does that make sense?

I thought that I could just change the webappDirectory property of the
maven-war-plugin configuration, but that causes other errors... (like
placing the web.xml file in the wrong dir)

Any help would be greatly appreciated.
-- 
View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13054612
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Simple WAR file question

Posted by Kram <ma...@gmail.com>.
Thats an interesting idea, I will have to think about the best way to do
this, it shouldn't be this hard...

I just need to figure out what is going on behind the scenes, then I can
make the right judgement

Thanks for the idea


Lee Meador-3 wrote:
> 
> What if your build had two steps.
> 
> 1) Create a whole new arrangement of folders by copying everything from
> the
> original format to a new layout. This is not done to be saved and reused
> but
> only to move the contents of all the folders into position so the Maven
> POM
> is short and sweet.
> 
> 2) Build with a simplified Maven POM to create the various artifacts (jar
> files, war files, javadoc, site, etc.)
> 
> It might be easier.
> 
> Thanks.
> 
> -- Lee Meador
> 

-- 
View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13641251
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Simple WAR file question

Posted by Lee Meador <le...@leemeador.com>.
What if your build had two steps.

1) Create a whole new arrangement of folders by copying everything from the
original format to a new layout. This is not done to be saved and reused but
only to move the contents of all the folders into position so the Maven POM
is short and sweet.

2) Build with a simplified Maven POM to create the various artifacts (jar
files, war files, javadoc, site, etc.)

It might be easier.

Thanks.

-- Lee Meador

On 10/9/07, Kram <ma...@gmail.com> wrote:
>
>
> yes well I wouldn't need to do it this way if the business would allow a
> project re-structure, but that would mean a switch the SVN from CVS and
> also
> the time to change around the project structure and then regression
> testing.
>
> So I'm sorry if this isn't an easy one, but thats why I'm looking for
> help.
>
> Im looking through the Maven source code now for a possible solution...
>
>
> Stephane Nicoll-2 wrote:
> >
> > yeeekeeeee!
> >
> > Well. Ahem. It's a bit hard to understand without the project at hand
> > to be honest.
> >
>
> --
> View this message in context:
> http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13126664
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

Re: Simple WAR file question

Posted by Kram <ma...@gmail.com>.
yes well I wouldn't need to do it this way if the business would allow a
project re-structure, but that would mean a switch the SVN from CVS and also
the time to change around the project structure and then regression testing.

So I'm sorry if this isn't an easy one, but thats why I'm looking for help.

Im looking through the Maven source code now for a possible solution...


Stephane Nicoll-2 wrote:
> 
> yeeekeeeee!
> 
> Well. Ahem. It's a bit hard to understand without the project at hand
> to be honest.
> 

-- 
View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13126664
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Simple WAR file question

Posted by Stephane Nicoll <st...@gmail.com>.
yeeekeeeee!

Well. Ahem. It's a bit hard to understand without the project at hand
to be honest.

On 10/9/07, Kram <ma...@gmail.com> wrote:
>
> Hmmm, ok. Well I can tell you that I am not allowed to re-structure the
> directory structure of my project. And it doesnt follow the standard Maven
> structure.
>
> Here is a snippet of the POM:
>
> <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/xsd/maven-4.0.0.xsd">
>
>         <modelVersion>4.0.0</modelVersion>
>         <groupId>au.com.sensis</groupId>
>         <artifactId>WITOL</artifactId>
>         <packaging>war</packaging>
>         <version>109</version>
>         <name>Work Item Tracking OnLine</name>
>
>         <!--Setup Custom Layout-->
>         <build>
>                 <sourceDirectory>webApp/WEB-INF/src</sourceDirectory>
>                 <plugins>
>                         <plugin>
>                         <groupId>org.apache.maven.plugins</groupId>
>                         <artifactId>maven-war-plugin</artifactId>
>                         <version>2.0.2</version>
>                         <configuration>
>                                 <!--
>                                         Defines the location of the web.xml, because its not in the
> default /WEB-INF/web.xml location,
>                                         we need to tell Maven where it is, relative to the POM file.
>                                  -->
>                                 <webXml>webApp/WEB-INF/web.xml</webXml>
>
>                                 <!--
>                                         Defines where the webApp directory is going to be created on
> output. This location will be
>                                         similar to: /target/WITOL-109/webApp
>                                  -->
>
> <webappDirectory>${project.build.directory}/${project.build.finalName}/webApp</webappDirectory>
>
>                                         <!--
>                                                 List of src files to exclude from the war file
>                                          -->
>                                         <warSourceExcludes>webApp/WEB-INF/src/**/*.java</warSourceExcludes>
>
>                                 <webResources>
>                                         <!-- Including required top level webApp directory resources -->
>                                 <resource>
>                                                         <directory>webApp</directory>
>                                                         <includes>
>                                                         <include>*/**/*.jsp</include>
>                                                         <include>images/**</include>
>                                                         <include>javascript/**</include>
>                                                         <include>styles/**</include>
>                                                         <include>stylesheets/**</include>
>                                                         <include>*</include>
>                                                         </includes>
>                                                 </resource>
>
>                                                 <!-- Including required WEB-INF directory resources -->
>                                                 <resource>
>                                                         <directory>webApp/WEB-INF</directory>
>                                                         <!-- All required WEB-INF folders and files to be defined here -->
>                                                         <includes>
>                                                                 <include>*.xml</include>
>                                                                 <include>*.dtd</include>
>                                                                 <include>lib/*.jar</include>
>                                                                 <include>config/**</include>
>                                                                 <include>tags/**</include>
>                                                      </includes>
>                                                      <!-- Target directory for output relative to webappDirectory -->
>                                                      <targetPath>WEB-INF</targetPath>
>                                                 </resource>
>
>                                                 <!--
>                                                         Including required top level "common" directory files . This includes
>                                                         all config and xml files for workflows, etc...
>                                                 -->
>                                                 <resource>
>                                                         <directory>common</directory>
>                                                         <includes>
>                                                                 <!-- Add in any extra configuration directories or files here -->
>                                                                 <include>config/**</include>
>                                                                 <include>emailTemplates/**</include>
>                                                                 <include>lib/**</include>
>                                                         </includes>
>                                                         <!-- Target directory for output relative to webappDirectory -->
>                                                         <targetPath>../common</targetPath>
>                                                 </resource>
>
>                                                 <!--
>                                                         Classpath dependant resources
>                                                 -->
>                                                 <resource>
>                                                         <directory>webApp/WEB-INF/classes</directory>
>
>                                                         <!-- Target directory for output relative to webappDirectory -->
>                                                         <targetPath>WEB-INF/classes</targetPath>
>                                                 </resource>
>                                 </webResources>
>                         </configuration>
>                         </plugin>
>
>
>                         <!--
>                                 By default Maven 2 doesnt allow for multiple sourceDirectory
> configurations, so this plug-in
>                                 fixed that. If any other source directories are created, just add them
> to the <sources> element,
>                                 relative to the root directory of the POM.
>                         -->
>                 <plugin>
>                                 <groupId>org.codehaus.mojo</groupId>
>                                 <artifactId>build-helper-maven-plugin</artifactId>
>                                 <executions>
>                                         <execution>
>                                                 <id>add-source</id>
>                                                 <phase>generate-sources</phase>
>                                                 <goals>
>                                                         <goal>add-source</goal>
>                                                 </goals>
>                                                 <configuration>
>                                                         <sources>
>                                                                 <source>common/src</source>
>                                                         </sources>
>                                                 </configuration>
>                                         </execution>
>                                 </executions>
>                 </plugin>
>         </plugins>
>         </build>
>         <!-- End Custom Layout -->
> </project>
>
> NOTE: this is without the dependancies
>
> Thanks for the help!!!!
>
>
>
> Stephane Nicoll-2 wrote:
> >
> > Your setup sounds a bit unusual to me and overcomplicated. Can you
> > show your pom file and provide more details?
> >
>
> --
> View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13106628
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Large Systems Suck: This rule is 100% transitive. If you build one,
you suck" -- S.Yegge

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


Re: Simple WAR file question

Posted by Kram <ma...@gmail.com>.
Hmmm, ok. Well I can tell you that I am not allowed to re-structure the
directory structure of my project. And it doesnt follow the standard Maven
structure.

Here is a snippet of the POM:

<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/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>au.com.sensis</groupId>
	<artifactId>WITOL</artifactId>
	<packaging>war</packaging>
	<version>109</version>
	<name>Work Item Tracking OnLine</name>
  
	<!--Setup Custom Layout-->
	<build>
		<sourceDirectory>webApp/WEB-INF/src</sourceDirectory>
		<plugins>
			<plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-war-plugin</artifactId>
	        	<version>2.0.2</version>
		        <configuration>
		        	<!-- 
		        		Defines the location of the web.xml, because its not in the
default /WEB-INF/web.xml location,
		        		we need to tell Maven where it is, relative to the POM file.
		        	 -->
		        	<webXml>webApp/WEB-INF/web.xml</webXml>
		        	
		        	<!-- 
		        		Defines where the webApp directory is going to be created on
output. This location will be
		        		similar to: /target/WITOL-109/webApp
		        	 -->
				
<webappDirectory>${project.build.directory}/${project.build.finalName}/webApp</webappDirectory>
					
					<!-- 
						List of src files to exclude from the war file
					 -->
					<warSourceExcludes>webApp/WEB-INF/src/**/*.java</warSourceExcludes>

		        	<webResources>
			        	<!-- Including required top level webApp directory resources -->
		            	<resource>
							<directory>webApp</directory>
						   	<includes>
						     	<include>*/**/*.jsp</include>
						     	<include>images/**</include>
						     	<include>javascript/**</include>
						     	<include>styles/**</include>
						     	<include>stylesheets/**</include>
						     	<include>*</include>
						   	</includes>
						</resource>
						
						<!-- Including required WEB-INF directory resources -->
						<resource>
							<directory>webApp/WEB-INF</directory>
							<!-- All required WEB-INF folders and files to be defined here -->
							<includes>
								<include>*.xml</include>
								<include>*.dtd</include>
								<include>lib/*.jar</include>
								<include>config/**</include>
								<include>tags/**</include>
						     </includes>
						     <!-- Target directory for output relative to webappDirectory -->
						     <targetPath>WEB-INF</targetPath>
						</resource>
						
						<!-- 
							Including required top level "common" directory files . This includes
							all config and xml files for workflows, etc...
						-->
						<resource>
							<directory>common</directory>
							<includes>
								<!-- Add in any extra configuration directories or files here -->
								<include>config/**</include>
								<include>emailTemplates/**</include>
								<include>lib/**</include>
							</includes>
							<!-- Target directory for output relative to webappDirectory -->
							<targetPath>../common</targetPath>
						</resource>
						
						<!-- 
							Classpath dependant resources
						-->
						<resource>
							<directory>webApp/WEB-INF/classes</directory>
							
							<!-- Target directory for output relative to webappDirectory -->
							<targetPath>WEB-INF/classes</targetPath>
						</resource>
		          	</webResources>
		        </configuration>
			</plugin>


			<!-- 
				By default Maven 2 doesnt allow for multiple sourceDirectory
configurations, so this plug-in
				fixed that. If any other source directories are created, just add them
to the <sources> element, 
				relative to the root directory of the POM.
			-->
	    	<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>common/src</source>
							</sources>
						</configuration>
					</execution>
				</executions>
	      	</plugin>
    	</plugins>
	</build>
	<!-- End Custom Layout -->
</project>

NOTE: this is without the dependancies

Thanks for the help!!!!



Stephane Nicoll-2 wrote:
> 
> Your setup sounds a bit unusual to me and overcomplicated. Can you
> show your pom file and provide more details?
> 

-- 
View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13106628
Sent from the Maven - Users mailing list archive at Nabble.com.


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


Re: Simple WAR file question

Posted by Stephane Nicoll <st...@gmail.com>.
Your setup sounds a bit unusual to me and overcomplicated. Can you
show your pom file and provide more details?

On 10/8/07, Kram <ma...@gmail.com> wrote:
>
> Anyone have any idea on this one?
> --
> View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13088353
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Large Systems Suck: This rule is 100% transitive. If you build one,
you suck" -- S.Yegge

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


Re: Simple WAR file question

Posted by Kram <ma...@gmail.com>.
Anyone have any idea on this one?
-- 
View this message in context: http://www.nabble.com/Simple-WAR-file-question-tf4573507s177.html#a13088353
Sent from the Maven - Users mailing list archive at Nabble.com.


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