aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Creating an ear file from war and jar files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Creating an ear file from war and jar files" Watch "Creating an ear file from war and jar files" New topic
Author

Creating an ear file from war and jar files

Pat Williams
Greenhorn

Joined: Apr 05, 2011
Posts: 6
Hello,

I am new to programming, and I hope I do not offend anyone with my questions.

I am trying to build an ear file in TeamCity from two projects, one project builds a war file and the other builds a jar file. I was told this could be done with a POM file, is that correct?
Any help would be greatly appreciated.

Many thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18657
    
    8

I don't see how anyone could possibly be offended by this question.

Only problem is, it doesn't have anything to do with XML as far as I can see. Looks more like a question about TeamCity to me, and when I google that I find it's a continuous integration product. So let's just move it to the forum which is about "automated build tools"...
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Yes, you can do this with a POM. What do you know about Maven?


JBoss In Action
Pat Williams
Greenhorn

Joined: Apr 05, 2011
Posts: 6
I do not know much, so far I pieced this together from another project.. and then tried running using mvn -e ear:generate-application-xml







this is the error when i run mvn -e ear:generate-application-xml



Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Please use code tags when posting source code - it makes posts easier to read. You can easily do this my selecting the source code in the editor box and then clicking the Code button above the editor box. I have edited your post for you this time.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

The errors you are getting mean that the dependencies you are listing cannot be found in the repository. That means either:

a) You got the names wrong, and thus they cannot be found. By the way, the "name" consists of the groupId, artifactId and version - getting any of of those wrong could result in a not found error.

b) The name is right but you are not referencing the repository that contains those artifacts.

c) The artifacts are not actually in a repository, in which case either of these are possible:

c1) When you built the JAR for the EJBs and the WAR, did you build them using "mvn install"? If you do so, then Maven will load the artifacts into the local repository

c2) Use the suggested "mvn install:install-file ..." can be used to load the artifact (JAR file) into the local repository so that it can be found.

My guess is that c1 is the most likely solution to your dilemma. Of course, I strongly urge you to first read up on maven and how it works otherwise you will run into a lot of frustration and you will end up doing things incorrectly.
Pat Williams
Greenhorn

Joined: Apr 05, 2011
Posts: 6
Thanks Peter,

It seems the issue is, this script is looking for a POM.xml in the repository and my projects are using ivy so they is no POM file. Do you have a suggestion for the best method to take a jar file and a war file from the repository and create an ear file?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16142
    
  21

Welcome to the JavaRanch, Pat! If anyone is offended by questions, it is they who are not welcome on the Ranch, not you! Our purpose in life is to provide a place where people can ask "dumb" questions without being flamed.

If you have stuff that was built using Ivy, that means that the tool used to build them was Ant, not Maven. That's OK, but for the Maven EAR task to incorporate those artefacts, they must be placed in the Maven repository, because that's where Maven goes to resolve dependencies.

There is a process where you can take any jar-type file you want and install it into the Maven repository. Take a look at the Maven docs on installing external (third-party) jars. You will have to assign a version number(s) to the components you install, since Maven is big into co-ordinating versions of software, but you can use any version numbering scheme you like.


Customer surveys are for companies who didn't pay proper attention to begin with.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

As Tim noted, "c2" in my prior post is the solution to the problem.
Pat Williams
Greenhorn

Joined: Apr 05, 2011
Posts: 6
Hi Guys,

I got it working, thanks to your help.
You guys are the best! I was always apprehensive to posting questions on sites.

Thank you for the help, and confidence boost.

P
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Creating an ear file from war and jar files