How to compile and run multi-module jersey web service? - maven

I'm new to maven and I'm trying to create a new multi-module jersey web service following this tutorial.
So now my project is composed of 3 maven modules:
* Model module
* Core module
* web service module
now, since I'm new to maven projects I don't know how to compile these modules and run my web service. What commands should I use when I update one of those 3 modules?

Usually one would run mvn clean install in the parent project and then mvn jetty:run from the web-service module (assuming you're using the Jetty plugin).

Related

How to build and deploy a multiple module Spring Boot maven app on External Tomcat container with Jenkins

My Spring boot app is a multi-module app and have 3 modules
models
service-impl
service-api
Each module has it own pom.xml with packaging type jar.
Parent pom.xml have packaging type pom
I am able to build and deploy it to integrated server on my local system but not sure how to build and deploy it via Jenkins Job on external tomcat server.
Is it possible to deploy them together in single war package or I have to build and deploy each service separately.

How to run codes written with maven build in Gradle

if I have created a spring Boot application using maven. Now I have to run the same codes in Gradle,So what all changes I have to make.
Here is the migration guide maven to gradle
A simple project can migrated by following chapter 3
3. Run an automatic conversion
install gradle to you system
run gradle init
Accordig to the same guide:
You’ll find that the new Gradle build includes the following:
All the custom repositories that are specified in the POM
Your external and inter-project dependencies
The appropriate plugins to build the project (limited to one or more of the Maven Publish, Java and War Plugins)

Automated deployment of EAR project without obtain dependencies from a repository

Is it possible deploy an artifact (.ear) into a application server (AS) without obtain its dependencies from a repository?
Let's me explain: the maven project I'm trying to configure for deploy into a AS has 3 modules:
Web (.war - front end)
EJB (.ejb - back end)
Entity (.jar - entities classes)
These modules are wrapped into a EAR module and none of then are available in some repository (like Nexus or JFrog Artifactory). When I try to use Cargo Maven plugin or JBoss Deployment Maven Plugin, both notify that cannot resolve dependencies for these modules.
UPDATED (03/01/2019)
The issue is similar to that quoted in items 6 and 7 of the following link: http://webdev.jhuep.com/~jcs/ejava-javaee/coursedocs/content/html/ejb-basicex-eardeploy.html#ejb-basicex-eardeploy-testmodule
It's a workaround but worked. Instead of the project depends on an internal repository (like Nexus or JFrog Artifactory), it's possible defines a folder as a repository on the local machine using the Maven's parameter -Dmaven.repo.local. Thus, the plugin to deploy the artifact also can use this property and obtaining the others artifacts.
That is, to build the application on the current folder:
mvn -Dmaven.repo.local=. package
To deploy the application (.ear, in this case) using Cargo Maven Plugin, for example, without depending on an internal repository:
mvn -pl app-ear/ -Dmaven.repo.local=. cargo:redeploy
OBS: Using the maven.repo.local property, the folder defined as value will be fill with all dependencies of the project. In my case, it isn't a problem because this commands are been used on a continuous integration pipeline and all files and folder are discard on the final.

Package and deploy OSGi bundles and Karaf features in Karaf Container

Recently, I have been working on Apache Karaf project.
The first one is a CXF REST service example and the second one is an Apache Karaf Maven example to run and deploy a Karaf container.
What I would like to do is to combine these two. The idea is to download a couple of JAR files from a repository and then package them into a Karaf.
Building Karaf Assembly manually then deploying the created JAR files in my deploy folder under Karaf is not a good idea if the task is reccurent each day. I would very much like to automate this if possible?
To achieve automatic deploy of Java project in Karaf, follow these steps:
Create a feature project: It is a Maven project and its goal is to create a descriptor of JAR (bundles) to be deployed under Karaf. The packaging of this Maven project is feature.
For your project of Karaf Assembly, add your feature as dependency and add it as boot feature so it can be installed when Karaf is up.
Look at this project https://github.com/benson-basis/karaf-feature-version-tc.
It has all the necessary configuration to automate Karaf building and deploy.

Using maven jetty plugin in multi-module project under Eclipse

I am working on a simple multi module maven project under Eclipse using m2eclipse with maven 3 and jetty plugin version 7. One of my module is a jar and the other module is a war which has a dependency on the jar.
Even though the workspace dependency resolution is enabled, the call to mvn jetty:run fails if I don't run mvn install before.
Having read about workspace dependency, I am not sure why a call to mvn install is required. I would like to be able to run the jetty plugin without installing the artifacts to my local repository. Is it possible?
Thanks in advance.
There is an integration module between m2eclipse and the WTP (Web Tool Platform).
WTP allow starting Jetty/Tomcat/... from Eclipse, debugging inside Eclipse, redeploy on change,...
Here is it: m2eclipse Extras

Resources