It's not a secret anymore!*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven War Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven War " Watch "Maven War " New topic
Author

Maven War

Phani.Kiran Gutha
Greenhorn

Joined: Dec 14, 2010
Posts: 14
Hi every one,
I have a war file build already using ant. which is super project.

I have child project where i want to add some more files to the existing war file and deploy the war file. in maven pom.

I have added the super war as dependency in the pom but the resultant war file doesnt contain any thing

<dependency>
<groupId>eagle</groupId>
<artifactId>webui</artifactId>
<version>1.23</version>
<type>war</type>
<scope>runtime</scope>
</dependency>

Can any one suggest me!

Thanks
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960
    
  19

If you built the WAR using Ant, you'll have to manually install it into your Maven repository. Maven pulls all its dependencies from repositories. When you build a war with Maven, the "install" goal will install the product into the repository, but Ant doesn't do that without being helped.


Customer surveys are for companies who didn't pay proper attention to begin with.
Phani.Kiran Gutha
Greenhorn

Joined: Dec 14, 2010
Posts: 14
"If you built the WAR using Ant, you'll have to manually install it into your Maven repository. Maven pulls all its dependencies from repositories. When you build a war with Maven, the "install" goal will install the product into the repository, but Ant doesn't do that without being helped."


Hi Tim,
I have installed the ant build war file into the repository.
my project strucuture is like this.





pom of webui is building a war file using the dependecy of the war file build by ant. and installing into the local repository.

But when i run maven build on parent/pom.xml a war file parent-1.0.war is build which contains nothings.

am facing problem when deploying parent project to jboss in eclipse the war file deployed into jboss deploy folder contains nothing?

Can you help me!!!

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

That is not a valid Maven directory layout. You should have something like this:



This layout will compile the classes in src/main/java, and combine them will the JSP, HTML and other files in src/main/webapp and build the WAR.

You mentioned Eclipse. Are you using the m2eclipse plugin? And are you using m2eclipse to create a Maven project?

P.S. I edited your last post. Please don't use the code tag when quoting others (really screws up the page formatting), use the quote tag instead. Also, do use the code tag when posting file structures and directory hierarchies, otherwise they are incomprehensible.


JBoss In Action
Phani.Kiran Gutha
Greenhorn

Joined: Dec 14, 2010
Posts: 14
Hi Johnson,

Thanks for your valuable suggestions about using the forum....................


And
am using M2 eclipse plugin , project and its modules were created using maven project........

comming to directory structure

directory structure mentioned by you is correct but. my project needs to be in structure i have mentioned ....
cant we change the directory structure and make it work!

Please help me!

Thanks once again!
Phani.Kiran Gutha
Greenhorn

Joined: Dec 14, 2010
Posts: 14
Phani.Kiran Gutha]"If you built the WAR using Ant, you'll have to manually install it into your Maven repository. Maven pulls all its dependencies from repositories. When you build a war with Maven, the "install" goal will install the product into the repository, but Ant doesn't do that without being helped.

Hi Tim,
I have installed the ant build war file into the repository.
my project strucuture is like this.





pom of webui is building a war file using the dependecy of the war file build by ant. and installing into the local repository.

But when i run maven build on parent/pom.xml a war file parent-1.0.war is build which contains nothings.

am facing problem when deploying parent project to jboss in eclipse the war file deployed into jboss deploy folder contains nothing?

Can you help me!!!

Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

directory structure mentioned by you is correct but. my project needs to be in structure i have mentioned ....
cant we change the directory structure and make it work!

Yes you usually can, if you like fighting with Maven. And if you don't mind that some Maven plugins will not work if you don't follow the standard layout. My suggestion is to abandon your layout and stick with the standard Maven layout.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maven War
 
Similar Threads
Ear Building in Maven
Richfaces + Spring + Maven Setup help
Maven web project dependencies
Could not resolve dependencies for maven project
Maven dependencies