Locally installed jar is not included in my IDEA tomcat deployment - spring

My IDEA project compiles and builds just fine when I compile using IntelliJ.
For some reason, when I deploy to tomcat using an exploded-war, 1 jar I have isn't included in the deployment and my spring app fails to load because it can't find the class.
The jar in question is a locally installed maven dependency i.e. on my laptop
Could this be the reason why it is being skipped by IDEA? It maybe tries to find the jar using maven, but since it is local is can't and skips it?
How can I fix this?
The IDEA project is a maven module and builds fine.

Put that jar into the libs folder of tomcat or embed it into your own jar using maven assembly plugin. https://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html

Related

spring boot startup fails when using war built on jenkins

We have a spring-boot application, built as a .war assembly (Maven build), which is deployed on the server with simple java -jar command.
As a part of CI/CD, the same code is being built on Jenkins. The Jenkins server is CentOS and the target deployment server is RedHat. The .war file built on Jenkins fails with Spring Beans Cyclic Dependency resolution error, while the same code when built on local(Mac OS) or on RedHat server works fine.
I tried to look through the war file, for each and every dependency, and everything looks same except for jsp-api-2.1 jar. The jsp-api-2.1.jar included in .war built on Jenkins has Created-By: 1.5.0_06-b04 in MANIFEST.MF, while the jsp-api-2.1.jar included in .war built on local (MacOs) or on Redhat has Created-By: 1.5.0_04-b05 in MANIFEST.MF. Other than this all other dependencies are the same.
The war files' sizes differ slightly, however, I could not find any difference other than what mentioned above.
The error which we are getting on Jenkins built jar is below,
Description:
The dependencies of some of the beans in the application context form a cycle:
| Class A
↑ ↓
| Class B
└─────┘
Does Maven generate any OS specific files, or are the dependencies downloaded from repository OS specific?
I can't really think of anything as both the .war files look similar. Any information on this will be helpful.

How can I include the jboss-client.jar present in the Wildfly bin/client folder to my maven project?

I have a maven project to which I have to add a external jar jboss-client.jar which is located in Jboss Wildfly 10 bin folder(bin/client). There is no version specified in the jar name.
When I add the jar manually in build path-it works fine.
However, since this is a maven project, I require a better way of doing this.
Note: The project works with only this jar and not other versions specified in pom.xml which I tried downloading.
Also, if I try to specify the external dependency in pom.xml, it asks for version of the dependency. However, I cannot specify the same as it is not mentioned in the jar.
My ultimate aim is to deploy this project in Jboss Wildfly 10.
Is there any other alternate way, I can add the jar?
Copy your jar to some other location and unzip/decompress it, then find Manifest file located at META-INF\MANIFEST.MF path.
Open it in text editor and look for Implementation-Version.
It will give you the version.
Reference
You can use maven to install third party library in local.
https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Using below command you can install.
mvn install:install-file -Dfile=path-to-file/jboss-client.jar -DgroupId=org.jboss -DartifactId=jboss-client -Dversion=1.0

Can we use Maven Dependency in Gradle Project Remotely

I am trying to host maven Dependency basically which I can use in Some other Gradle project.
I have also try this locally but I want to do it remotely.
I also try to do this in some other manner - I just host one jar file in tomcat server and tried to download in my gradle project.
"http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar" this is the hosted jar path in which we can eaisly download jar file by hitting this ulr.And "C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar" this is my local .m2 repository.
In this gradle project I can easily download the jar files using compile files ("C:/Users/USERNAME/.m2/repository/commons-io/commons-io/2.2/commons-io-2.2.jar") but I am not able to download hosted jars i.e - http://10.10.177.157:8080/face_rec/images/jmf-2.1.1e.jar
Can someone give me any idea about this that how can it is possible.
thanks

Maven JBOSS application deployment

I followed this tutorial http://www.mastertheboss.com/jboss-maven/jboss-maven-example-building-a-java-ee-6-application/ in order to have a simple web application to better understand Java EE and JBOSS. I set up the example project (by archetype) and compiled it.
However, I am stuck after running mvn compile. I want to deploy my application as a war file to my JBOSS webroot directory (in my case /usr/share/jboss-as/standalone/deployments/).
I think mvn package and mvn install must be executed. Where can I specify that I want a war file and that it should be copied to my deployment location on JBOSS?
Obviously, I can use the jboss maven plugin http://docs.jboss.org/jbossas/7/plugins/maven/latest/, which is addressed via console
jboss-as:deploy
Configuration is read from the POM file.

maven does not copy dependencies

I have Dynamic Web Application project in eclipse that was converted to maven project.
Problem is that all dependencies are copied to:
<project>/target/<project>-SNAPSHOT/WEB-INF/lib
not <project>/WebContent/WEB-INF/lib
so when I run application from eclipse, there are no libs from maven and I get some errors.
I assume that application started from eclipse i.e on tomcat server gets it source from <project>/WebContent/WEB-INF/lib.
You should use m2e (Maven Plugin for Eclipse). It automatically adds Maven dependencies to the classpath, so you don´t need them in /WEB-INF/lib while running from Eclipse.

Resources