I have a maven project i need to copy the jar files from a ftp server to the lib folder during the mvn clean install task.
Suggest me the plugins or steps to achieve this.
THANKS
you can't do that .because Maven resolves its dependencies via HTTP,
you can deploy via ftp but not resolve the dependencies
Related
I am trying to add the Maven dependencies of a Maven project into a non-Maven project. However, there are too many and adding them one by one would be too tedious. Could someone suggest a shortcut to add them all at once?
What do you mean by adding dependencies to a non-maven project?
If you want to make it a maven project, right-click the project and in configure click convert to maven project. Otherwise, you can copy-past the jars into your build path. If you have the other maven project in your computer, you can locate the jars in .m2 folder in your user directory and add them to the project or download them one by one.
Run the following maven command in the main directory of your maven project:
mvn dependency:copy-dependencies
Then you will be able to find all of the downloaded jar files of your dependencies here:
{PROJECT-MAIN-DIRECTORY}/target/dependency/
You can add the -DoutputDirectory parameter to have the jar files placed somewhere else.
Afterwards you may simply add the jars to the build path of your non-maven project.
Creating a Jar file:
I want to create Jar files from a Github Java repository. How can I create below Jar files?
Jars to create:
geo-ip-java.jar
hive-udf-geo-ip-jtg.jar
Git URL: https://github.com/edwardcapriolo/hive-geoip
I found we can create them as below syntax, but seems it is using maven to compile them:
jar cf jar_file.jar file.java
As this is a maven project (as seen that the file pom.xml exists) you can create the target artifact (in your case the jar file) by simply executing mvn package.
If you want to use the jar file in another maven project (as dependency) then it is more usefull to use mvn install as this also installs the artifact in your local repository.
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 would like to have all the JAR files of Maven in my hard-drive to do some experiments. Is there any way to download all the jar files from Maven repository?
My operating system that i used is Windows 7.
It is not clear what you mean by "all the JAR files of Maven", the Maven central repository contains gigs of jar files. If you can explain further what you are trying to do then it will be easier to help.
If you have a maven project then you can run:
mvn clean install
from the directory where the pom.xml file is located. Maven will download all of the dependencies required by the project to your computer, the default location is the .m2 directory under your user directory.
Another option is to use the maven dependency plugin to download all of the dependencies of a given project to a location.
Use a repository manager like Nexus. http://nexus.sonatype.org/
or Apache Archiva too http://archiva.apache.org/ :-)
See http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix
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