When I right click on my Maven project and choose the Add dependency option and I type my external jar's name in query, it is not found. How to add external jar to a Maven project?
相关问题
- Dependencies while implementing Mocking in Junit4
- Step by step instructions for getting cppunit up a
- org.jdesktop.application package doesn't exist
- Include pom.xml in Jar with gradle
- What order does maven find its dependencies?
相关文章
- IDEA2020 安装maven 插件后,springboot程序 SpringBootApplic
- pom文件中的插件定义
- pom.xml中的project为何报红
- Hibernate Tutorial - Where to put Mapping File?
- java.lang.NoClassDefFoundError: javax/servlet/http
- 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
You can follow this tutorial: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Example:
Install the jar to your local maven repository:
Edit the pom.xml file in your project to include the newly added dependency:
This should work regardless of the IDE you are using.
From the NetBeans forum:
group.id
(can be anything)artifact.id
(can be anything)1.0
(can be anything)Dependency is added to
pom.xml
and appears under the Libraries node of Maven project. Continue:Library is installed locally with dependency attributes (coordinates) entered in steps 4 - 6.
I found those instructions helpful when going through the NetBeans GUI. Basically when right clicking to add a dependency, the group id, version, and name must be populated with anything. Then that "dependency" will be listed in the dependency drop down. Right click on that newly created dependency and right click to install locally and navigate to the appropriate jar file.
In Netbeans, the approach to adding dependencies that are not in repository is reversed. First come up with maven coordinates in the Add Dependency dialog. Then right click on the new dependency node and trigger "Manually install Artifact" action.
This answer is for jars that are in the maven repo
Let's say I want to add
log4j-1.2.17.jar
to my project, all I have to do is find it in maven repositoryStep 2 is to copy that and place it inside the dependencies tag of your pom.xml` file:
Step 3 Build and clean your project. The jar file will be in your dependencies folder afterwards