I have 3 maven projects:
1 - common pojos project
2 - web project
3 - java client project
web and java project uses same pojos from common project, have dependency on 1 project
I added to web build path common pojos project,
but when I deploy web project to server, no pojo classes exceptions....
My question is how can I configure it to get my pojos classes deployed with all web project ?
(it will be fantastic, If you have some online examples for this)
Tnx.
If all your 3 project are maven projects and the dependencies are set right then maven will automatically package all the dependencies into the war.
commons pojos is a jar project
web project is a war project which depends on commons pojos project. Unless the dependency scope is not provided the jar will be packaged in the war.
You can verify the same by opening the war file as see if the commons pojos jar is present and the jar has the required classes.
Related
I have made a maven Spring boot (REST) Project that has 3 (maven) sub modules (i. api ii. implementation and iii. service modules).
The main method (#SpringBootApplication) is in the root of the project. The REST web service works fine from IDE but maven does not allow me to package this project as war and deploy to external tomcat.
To solve this I added a new module and added dependencies of other modules within this and packaged this as war (by adding maven-war-plugin). But when deployed on server; the webservice does not get hit.
Structure-
Service Project
main()(This is within root project)
api module
service module
implementation module
Newly added module (that has above 3 modules injected as dependency and the plugin that let me package this as a war)
Expecting a war that has all these submodules that can be deployed on external Tomcat 9 server.
How to achieve this?
Please Note - I have added spring-boot-maven-plugin
to repackage in the root project, but it is not working.
Adding parent to this newly added module fixed the issue and I was able to make a working jar!
I am using Spring Tool Suite (STS) for my Spring boot application development.
I am using the Spring Started Project option to select the component required for my applications. For example: if I want to develop web application, I will select the "web" check box and spring io initailzier will download all the required jars in the classpath with help of maven.
Suppose, after the project creation for WEB, If I want to add some other components in my existing web project like using Eureka, Hystrix, the required jars are not automatically setup in the classpath and couldn't use the annotation like #EnableEurekaClient as it throws error as jar is missing.
I have manually updated the pom.xml to include the Eureka starter/client/server dependency and trying to update the project (Project >> Maven >> Update Project), so that required jars will be in classpath. But it is not happening.
Any advise on it..thanks.
I am trying a create JEE spring web project (+spring security, mvc, web flow) and it will be a maven project with IntelliJ IDE.
I tried :
1) Create Project as "Spring",
2) Additional Libraries and frameworks : Spring, Spring MVC, Spring Security, Spring Web Flow. Web Application, Application Server, Hibernate.
And click on Finish button.
3) After project created, right clicked and "Add frameworks support" and selected maven.
I have three questions :
1) Is this a right approach to create a spring web maven project with IntelliJ?
2) Project has a lib folder that has spring, hibernate jars etc. They are not included in pom.xml file as dependency. How can i make them as they defined in pom.xml file so these jars will be in "External Libraries" folder?
3) When i didn't select "Application Server" while creating a new project, I cannot add later, when the project is created using "Add frameworks support". Why?
Thanks in advance.
Is this a right approach to create a spring web maven project with
IntelliJ?
No, create a Maven (or Gradle) project form starting point and then add dependencies through Maven (or Gradle) dependency management system. Generally, managing dependencies through lib folders or System Wide Dependencies are NOT good ideas. Read more on
Project has a lib folder that has spring, hibernate jars etc. They are
not included in pom.xml file as dependency. How can i make them as
they defined in pom.xml file so these jars will be in "External
Libraries" folder?
Delete all jar files and replace them with dependency section of pom.xml. You should find groupId, artifactId and version coordiantes of each one. For example, for spring-core module, you should add this to your <dependencies></dependencies> section:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.2.0.RELEASE</version>
</dependency
When i didn't select "Application Server" while creating a new
project, I cannot add later, when the project is created using "Add
frameworks support". Why?
After creating project, you can add Application Servers or Servlet Containers through Run > Edit Configuration settings.
I have created an JEE application in Openshift using the JBOSS AS 7.1 cartridge a Maven project have been generated with the War deployment format.
I need to use EJBs into the application but the War format cannot hold EJB so I changed the from War to Ear, the problem is that when I deploy the Ear the application does not Work(404 Error when I access the home page).
Is there any simple solution in order to make this work?
Or Should I create two seperate projects(one EJB project and another JSF project) and a parent POM?
Actually it is possible to package EJBs inside a WAR archive : JEE6 Tutorial, so I decided to stick with that.
Alternatively it is also possible to convert a project from WAR to EAR by using Maven's project composition (useful link).
I'm using Eclipse and want to setup a MAVEN project which contains two modules for frontend and backend with JSF, Spring and Hibernate.
What I know:
- Create a Maven Project (packaging POM) without archetype
- Create Modules and select the Parent Project (Frontend JAR, Backend WAR)
Which archetypes can I use to combine JSF, Spring, Hibernate?
Do I have to use the same archetype for both modules?
Thanks for any help!
maven archetype is only template those prepare projects folder structure, dependency etc. See
Maven archetype
So you can create both module like simple module without archetype and self create folder and depency...
If you can use some archetype you can use some of these
ex: for main project: appfuse-basic-jsf and Maven create project which use Spring, hibernate and JSF
or softeu-archetype-jsf for JFS nodule and spring-osgi-bundle-archetype for Spring