Nadia
Nadia

Reputation: 45

Can i deploy a war that contains a JAR dependence?

Can I deploy my web maven project knowing that it has a dependency to an EJB maven project? Or do I have to create a EAR where I will package both of them and then I will be able to deploy them?

Thank you

Upvotes: 0

Views: 69

Answers (2)

rdcrng
rdcrng

Reputation: 3443

No you do not have to create an EAR. Java EE Web profile supports packaging EJBs into a WAR, either in /WEB-INF/lib or /WEB-INF/classes. So since you have a separate EJB project, just place it into the /WEB-INF/lib. Since you're working with Maven, just list your EJB project as a dependency to your web project.

Update

Since you're working with maven, your EJB project's pom.xml will contain the <artifactId>, <groupId>, and <version> for that project under the root element. Just copy those three to you web project's pom.xml under the <dependencies> element. Then when you build your web project, maven will automatically bundle your EJB project in the correct place in the WAR.

Upvotes: 2

Nadia
Nadia

Reputation: 45

i figure out how to add the Jar into WEB-INF/lib 1.Add the jar file to your WEB-INF/lib folder. 2.Right-click your project in Eclipse, and go to "Build Path > Configure Build Path" 3.Add the "Web App Libraries" library

This will ensure all WEB-INF/lib jars are included on the classpath.

Thanks anyway for ur help

Upvotes: 0

Related Questions