简体   繁体   中英

Maven doesn't put downloaded jars in eclipse's JRE System Library “folder”

I have created project using this command:

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

After downloading libraries my project looks like this: http://i43.tinypic.com/2iut1me.jpg

How can I "tell" maven to download jars in just one folder?

Maven will not download jars in a single folder, instead, it create a dir structure in a $HOME/.m2/repository for managing your dependencies, including versions.

If you want the jars to show in the Eclipse project, create a pom.xml file in your project with the correct dependencies, for example

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.myGroup</groupId>
<artifactId>myProject</artifactId>
<name>myProjectName</name>
<version>myProjectVersion</version>
<packaging>jar</packaging>

<dependencies>
        <dependency>
            <groupId>dependency1</groupId>
            <artifactId>dependency1</artifactId>
            <version>dependency1</version>
        </dependency>   
        <dependency>
            <groupId>dependency2</groupId>
            <artifactId>dependency2</artifactId>
            <version>dependency2</version>
        </dependency>   
        <!-- .... and so on -->
</dependencies>

Also, configure your project in eclipse to be a Maven project and then you will see "Maven Dependencies"in your project.

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