This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating an ear file from war and jar files

 
Pat Williams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20158
23
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you can do this with a POM. What do you know about Maven?
 
Pat Williams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17615
38
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Tim noted, "c2" in my prior post is the solution to the problem.
 
Pat Williams
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic