Spring boot maven plugin - transitive dependency not working - maven

As per Spring boot maven plugin docs - http://docs.spring.io/spring-boot/docs/1.5.2.RELEASE/maven-plugin/usage.html,
it will include all "provided" scoped dependencies also.
But for me , it is not happening. When I remover "provided" scope, it works fine and dependencies are included.
Can you let me know how to solve this ?
I have installed maven in a windows box and running it using command prompt (no IDE)

Related

How do I instruct Spring Boot Devtools where to find dependencies in a Maven project

I've got a Spring Boot Maven project that creates an executable fat .war. I can run this .war using java -jar without any issues as all dependencies are located within the far .war.
However, I can't run the project with the Spring Boot Devtools using mvn spring-boot:run as it fails to find some dependencies at runtime and throws unhandled exceptions.
For example, we've got an indirect dependency on jaxb-runtime-2.3.1.jar which in turn has a dependency on jaxb-api.2.3.1.jar. Both .jars are present in the fat .war but if I run the project with mvn spring-boot:run it can find jaxb-runtime ok but fails to find jaxb-api with the message:
java.nio.file.NoSuchFileException: ~/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-api-2.3.1.jar
Note, jaxb-api-2.3.1.jar is present in the maven cache at:
~/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
however it seems to be looking for it in the same location as the parent jaxb-runtime-2.3.1.jar which is located at:
~/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/
There's a long list of similar exceptions that follow this pattern. It's quite a large project but here are some of the versions we're using:
Spring Boot: 2.1.9.RELEASE
spring-boot-maven-plugin: 2.1.9.RELEASE
maven-compiler-plugin: 3.8.1
spring-boot-devtools: not specified in pom
Why does spring-boot:run not locate dependencies in the same way as the maven build? How can I instruct it where to find these dependencies?

deployment error through maven using ----java jar <jarfile>.jar

I have created a Spring Starter data jpa project and its connecting with mysql. through STS its running fine.
i wanted to deploy it individually so i clean install the application using maven and used java jar <jarfile.jar> in command prompt.
I followed the video of java brains.
Below is the error which get
JAXB is not found.
It seems that you set the scope of the JAXB dependency to provided or built the project for an old Java Version (like Java 8) that comes with JAXB and run it with a newer Java version (like Java 10) that does not come with JAXB.
You can fix this by adding the JAXB dependency to the classpath when running the JAR or by adding the dependency to your project manually(or set the scope to compile)

Add to classpath external libraries in intellij 2017.3 on run application without changing scope

Hi guys I have a problem in IntelliJ IDEA. I have a configuration for run my application. When I run it somes libraries added like dependencies in my module and defined with scope "Provided" are not added to classpath and give me a class not found exception.
If I change the scope from "Provided" to "Compile" it does work.
But i'm not sure it is right becouse in my pom.xml they are configured with scope "Provided" and when I run maven configuration the dependencies are changed to "Provided" in project structure and it does not work again.
My question:
Is there a way to include some dependecies in classpath during run without changing the scope in pom.xml?
IntelliJ IDEA 2018.1 has an option to include the dependencies with the provided scope into classpath, it's available for some run/debug configurations, like Application and Spring Boot.

Mavenize Grails project not works in STS

I am using STS 3.6.1, Java 7, Grails 2.4.3.
When create a normal Grails project, it works good. However, my Grails project need to depends on other java projects, so I convert it to maven project. After that STS prompt error
Could not find the grails dependency file. This probably means that there is a bad dependency in the pom file.
java.lang.Exception
The maven grails project can be build in grails command.
How to resolve is issue? Or if there is walk around to let grails project depends on other Java project.

POM file for integrating Grails with Maven, with dependencies in BuildConfig.groovy

I've got a Grails application as part of a larger Java source bas that's all built with Maven. I'd like to include the Grails app in the Maven continuous integration, nightly builds, etc.
(Ideally I'd also like it to be part of a Maven parent-project hierarchy, so I could pick up live code changes from other projects without having to install them into my local repository. I would also like a pony.)
I tried running "grails create-pom", setting "pom true" in BuildConfig.groovy, and using the POM to manage my dependencies. However, this left me stuck in org.xml.sax.Locator classloader hell. So I went back to using BuildConfig.groovy for my dependencies.
I understand that "pom true" is a recent (Grails 2.1.0) feature, and it should be possible to integrate Grails into a Maven build while still managing dependencies in BuildConfig.groovy. Problem is, I can't find any documentation on what should go into the POM in that case. What do I put in my POM?

Resources