overexchange
overexchange

Reputation: 1

Where does maven dependency fetch packages from?

As per this below snapshot, I see list of packages for hibernate:

enter image description here

I regularly see update index activity by m2e plugin(maven) in eclipse, for which I have no clue, What does it mean?

Where are these packages fetched from and displayed?

What is groupId/ArtifactId? Why can't one just say package/class instead?

Upvotes: 2

Views: 1391

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 522817

Where are these packages fetched from and displayed?

By default, Maven will download from the Maven Central Repository, which is located at this URL: http://search.maven.org/

You can also add a custom repository by using the <repository> tag. Here is an example of how you can add the JBoss repository to your Maven project:

<project>
    <repositories>
        <repository>
            <id>JBoss repository</id
            <url>http://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
    </repositories>
</project>

Maven will download the artifacts when it needs them. So doing an mvn update or mvn install would trigger Maven to go to the repository if it doesn't already have the necessary JARs locally. And the local folder where the JAR files gets stored is C:\Users\your_windows_user\.m2\repository by default.

What is groupId/ArtifactId? Why can't one just say package/class instead?

Maven operates by managing dependencies, which are individual JAR files. So if you need to use a class, Maven will pull in the entire JAR file containing that class. The main reason for this is that Java libraries typically ship as JAR files, not individual classes.

Upvotes: 3

Related Questions