I have a large project having a number of maven modules under the root module datastore , In one of the modules I am using the jersey client dependencies as ,
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
This is the dependency which is to be used.
The Client was working fine.
Then, I copied the same code with same imports of jersey into other multi-module maven project and added the dependencies into pom XML.
But now the code crashes and I found out that the dependencies that are being referred now are different!!
So, I want to know:
How to explicitly specify which dependencies are to be used? (Note: I changed the pom of this new module but it is again getting jersey deps. from parent pom)
It seems like your project may have a different version of jersey libraries ,
Because there are a lot of changes in jersey 1.x and jersey 2.x APIs
So instead of getting multiple conflicting dependencies for the same lib , try to modify/upgrade your code to match jersey 2.0 API
Here is a guide for code migration
Related
On looking at the spring-boot-starter-web, spring-boot-starter-security projects on github, i find them to be empty with just a build.gradle file present there.
I hope this is as expected, but this leads me to understand where the actual source code can be found. And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
I hope this is as expected
This is as expected. Spring Boot's starter modules exist purely to being multiple dependencies together into a convenient "package". For example, if you want to write a Servlet-based web application using Spring MVC and Tomcat, a single dependency on spring-boot-starter-web provides all of the dependencies that you need. You can learn a bit more about the starters in the reference documentation.
Where the actual source code can be found
The majority of the code can be found in spring-boot-autoconfigure. For more production-focused features, you'll also find some code in spring-boot-actuator-autoconfigure. The code in these two modules is activated automatically when the dependencies that it requires are on the classpath. You can learn more about this conditional activation and auto-configuration in the reference documentation.
And I use maven, so I was expecting atleast a pom.xml in these projects. But since it is not present, I am wondering how spring boot team publishes there artifacts to maven central repo.
Spring Boot is built with Gradle which, unlike Maven, completely separates the configuration needed by the build system to build the project and the information needed by a build system to consume the project. The build.gradle files provide all of the information that Gradle needs to build the project. As part of this, it generates Gradle module metadata files and Maven pom.xml files that contain all of the information needed to consume the project with Gradle and Maven respectively. These generated files are then published to Maven Central alongside the jar files, source code, etc.
I am migrating up to springBootVersion = '2.2.10.RELEASE' from 1.x,
and when I compile against it, I have spring-integration-core-5.2.8.RELEASE.jar,
But I cannot locate this.
import org.springframework.integration.dsl.amqp.Amqp;
Documentation says I don't need to declare the dsl package due to duplicate declarations. Am I missing something?
What you don't to show pom file here ? But anyway
In Spring Boot 2.2.x include Spring Integration 5.0 if your pom to have dependency.
org.springframework.integration
spring-integration-java-dsl
Delete it.
Documentation says it has been added to the version 5.0. Put it in pom or any other spring-cloud-starter- Spring Cloud include spring-integration.
spring-cloud-starter-stream-rabbit
Check in link https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-4.3-to-5.0-Migration-Guide
org.springframework.integration.dsl.amqp.Amqp;
Now located in
org.springframework.integration.amqp.dsl.Amqp;
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!
Maven allows one to import dependencies, for example importing Spring Boot dependencies, into a project that has a different parent using import scope. How does this impact plugin management?
I want to use the plugin versions defined in the <pluginManagement> section of the imported dependency (<spring-boot-dependencies> in this case), but I notice different versions of plugins, like surefire, used in different environments, like on TeamCity and locally.
With maven you can only inherit pluginManagement when using that POM as a parent.
Scope import only brings you dependencyManagement.
There is a ticket on the maven issue tracker though : https://issues.apache.org/jira/browse/MNG-5588
According to the Spring Boot docs, when Using Spring Boot without the parent POM, you can still keep the benefit of the dependency management (but not the plugin management).
I am using Spring Boot 1.4.1 with Gradle 3.1. The module which has the Spring Boot plugin applied creates its own jar with the jar task, and also has the 'fat' jar created with bootRepackage. However, the classes from that module are in BOOT-INF/classes, but I would like them to be in a separate jar in BOOT-INF/lib. How to do this?
EDIT: I know I can move the code to a separate module, but for various reasons I can't make such a split (unless there is no other way). I am looking for a single-module solution, if one exists.
You'll need to set up a multi-project build and move all of your Jersey-related classes into a separate project. You can then depend upon this new project in your Spring Boot project using a project dependency. For example:
dependencies {
compile project(':jersey-endpoints')
}