简体   繁体   中英

Where is my pom.xml file in Java?

Right now I added the MongoDB driver, a jar file, to my project library so I can use the driver. But I want to use Maven. I have the dependency:

<dependencies>
<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongodb-driver</artifactId>
    <version>3.0.4</version>
</dependency>

and I know I am supposed to add it to a pom.xml file. However even with internet searches I can't find out where the pom.xml file is.

It must be in your root directory. Go to your project location in the file system. If you project is of maven nature, there must be a pom.xml .

If not, no worries.

If you are using Eclipse IDE, you can convert your project into maven project by right-click on the project and click configure and then convert to maven project .

If you installed maven explicitly (I mean not plugin only), You can create a new maven project and add your mongo dependency there.

mvn archetype:generate -DgroupId={project-packaging} 
-DartifactId={project-name} 
-DarchetypeArtifactId=maven-archetype-quickstart 
-DinteractiveMode=false

More details can be found here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM