I am using eclipse for my project development. In my pom.xml no where I have added dependency for Jetty jars (jetty-server, jetty-io, jetty-http, ...). But when I run "mvn package" command in my local repository and in my WEB-INF --> lib folder these jetty jars are getting added. But I don't want to use those jars. Can someone please suggest me a way to delete these jars through pom.xml.
In my local repository its getting added in repository --> org --> eclipse --> jetty. I tried to delete it by making use of tag in pom.xml, but couldn't resolve.
type mvn dependency:tree in console. You will see where from those jars are
You can try to run your maven project from Console with the command mvn clean package inside the folder that you have your pom.xml file. With this command you clean your application. Maybe this can remove these libraries
Related
I have a package in one Spring Boot project. The package contains domain objects.
The folder looks like this:
IDomainModel
ModelOne
ModelTwo
How can I make a jar of only these files then bring it into my other projects. I cannot use artifactory.
I will assume you have used maven.
If you have installed de jar using mvn install, then it should be available for all the projects you try to build.
Since mvn install puts your compiled jar in your local repository with the groupId, artifactId and version you provided in your pom.xml file. Then you could use that same jar as a dependency in any project with access to your local repository.
I'm trying to produce a Maven-compatible artefact using bazel. I noticed that mvn puts some files inside META-INF directory in JAR archive (file.jar/META-INF/maven/groupId/artifactId/pom.xml and file.jar/META-INF/maven/groupId/artifactId/pom.properties)
Questions:
Are they needed to be able to successfully depend on my artifact from another project? I know you can disable them via a config option in pom.xml ref, which leads me to believe that you don't.
Are they used by mvn in any case whatsoever?
Can I use pom.xml inside on the JAR instead of pom.xml near my artifact in Maven repo?
We have several jars in your Maven repository that do not contain a pom.xml. For maven, the revelant pom.xml is the one that is outside your artifact. In Nexus, you deploy a jar always along with a pom.xml and that is the one that counts.
So you need to publish a pom.xml along with your jar if you want to use it from Maven, but you do not need to put it inside. AFAIK you cannot change this behaviour.
I have a maven based project where I have to invoke an external jar (say country.jar)
I added this jar on src/lib folder and did below setting in pom.xml
<dependency>
<groupId>country-stubs</groupId>
<artifactId>country-stubs</artifactId>
<scope>system</scope>
<version>1.0</version>
<systemPath>${basedir}\src\lib\country.jar</systemPath>
</dependency>
While Running my application I am getting error
java.lang.NoClassDefFoundError: com/fsg/bpo/webservices/countWebService
Location(com/fsg/bpo/webservices/countWebService) is referring to the class present under country JAR
Do I need to add few more settings to configure external JAR in maven ?
If you are using scope system you are saying it is a provided jar later on. I would use runtime maybe. Have a look at maven scopes
If it is web application then your jar won't get bundled inside your war file. Then you will get this issue. you can directly copy this country.jar to your WEB-INF lib folder and use that system path.
1st u need to add ur external jar to ur local maven directory..
using below command on cmd..
mvn install:install-file -DgroupId= -DartifactId=aes-decryption -Dversion=1.0.0 -Dpackaging=jar -Dfile=./target/aes-decryption-1.0.0.jar -DgeneratePom=true
I have mvn web application project. I run
mvn clean install
mvn eclipse:eclipse
in target{project-name}\WEB-INF\lib dictonary, here is all jar files (amount of all jar is 77), that I have declared in pom.xml.
I have created new server in eclipse .
add priject to server.
when I open servers project lib dictonary path\apache-tomcat-8.0.14\webapps{project-name}\WEB-INF\lib
I found all jar files, except one (amount of all jar is 76).
why this happens?
I do not have this jar file:
<dependency>
<groupId>org.lazyluke</groupId>
<artifactId>log4jdbc-remix</artifactId>
<version>0.2.7</version>
</dependency>
The same happens , for example, when I add another jars in pom.xml. I do not understand why eclipse does not copy all the jars...
Eclipse version: Luna
Tomcat version: 8.0.14
There are issues with eclipse-maven synchronization. If pom is changed this doesn't get synchronized with webapps already deployed on the Tomcat. So you need to do
Tomcat>Clean...
This will do the sync. Also make sure maven dependencies are added in
Project>Properties>Deployment Assesmbly
I updated the pom.xml to spring 3.0.1.RELEASE instead of Spring 2.x.x .
So when I did 'mvn clean install', the lib directory in my target directory was correctly updated with the right jar files.
But when I do a right click on my project and then go to "Build Path", I notice that I have the old dependencies of spring and not the dependencies for spring 3.0.
How can I update the Java Build Path?
If this is eclipse (you are using), then you need to update the Eclipse project file from the .pom file. That is done by doing the following command:
mvn eclipse:eclipse
After that, refresh project in eclipse and you will see that eclipse recognises the dependencies from the pom file.