I started to convert my project to maven because I needed to use a library that was distributed in binary form over maven only, but after banging my head against the wall on it for far too long I've decided to stop hurting myself and just use Ant. I'd like to just have maven download the jar and all of its transitive dependencies into a directory of my choosing so I can just check them into my SCM as I normally enjoy and be a blissful developer once again.
Any ideas how to do that easily?
相关问题
- How to download and run a .exe file c#
- Include pom.xml in Jar with gradle
- What order does maven find its dependencies?
- proguard causing EnumMap NPE on dynamically declar
- Maven: How to read the Parent POM version
相关文章
- IDEA2020 安装maven 插件后,springboot程序 SpringBootApplic
- pom文件中的插件定义
- pom.xml中的project为何报红
- Hibernate Tutorial - Where to put Mapping File?
- Cannot use org.jvnet.jax-ws-commons.jaxws-maven-pl
- New Maven install: mvn -version java.lang.ClassNot
- What's the difference between archetype.xml an
- NoNodeAvailableException[None of the configured no
I found the next command
mvn dependency:copy-dependencies -Dclassifier=sources
here maven.apache.org
Based on @Raghuram answer, I find a tutorial on Copying project dependencies, Just:
Open your project
pom.xml
file and find this:Than replace the
<plugins> ... </plugins>
with:And call maven within the command line
mvn dependency:copy-dependencies
After it finishes, it will create the folder
target/dependency
within all thejar
's dependencies on the current directory where thepom.xml
lives.Please check if you have some config files in
${MAVEN_HOME}/conf
directory likesettings.xml
. Those files overrides settings from.m2
folder and because of that, repository folder from.m2
might not be visible or discarded.Create an ivy.xml file to list your project's dependencies:
Downloading these jars and their transitive dependencies can now be done in one of two ways.
Command-line
Ivy can be run as a command line program. The following example will download into a local "lib" directory:
ANT build
ivy is best used when integrated into your ANT build. The following example target downloads the jars into a local lib directory and generates a HTML report for dependency analysis.
I finally figured out a how to use Maven. From within Eclipse, create a new Maven project.
Download Maven, extract the archive, add the
/bin
folder to path.Validate install from command-line by running
mvn -v
(will print version and java install path)Change to the project root folder (where
pom.xml
is located) and run:mvn dependency:copy-dependencies
All jar-files are downloaded to
/target/dependency
.To set another output directory:
Now it's possible to re-use this Maven-project for all dependency downloads by altering the pom.xml
Add jars to java project by build path -> configure build path -> libraries -> add JARs..
maven dependency plugin can potentially solve your problem.
If you have a
pom
created with all your project dependencies specified, all you would need to do is runmvn dependency:copy-dependencies
and you will findtarget/dependencies
folder filled with all the dependencies, including transitive.