Working with Maven Repositories
See Also
Software library archives (JARs), build artifacts and dependencies
that are used to build Maven projects are stored in repositories.
There are two types of repositories:
- Local repositories. A cache of a remote
repository that is stored on the local machine.
Maven projects are built against the local repository.
The local repository usually only stores a subset of the files
available in the remote repository and any temporary build artifacts.
- Remote repositories. A repository
that contains all the Maven artifacts and plugins.
The remote repository may be a third-party repository
(e.g. http://repo.maven.apache.org/),
or it may be a private internal repository.
The IDE indexes the contents of local and remote Maven repositories using the Nexus indexing engine.
The IDE uses the repository indexes for some Maven-related functions such as code completion.
You can browse and manage Maven repository indexes in the Services window.
To browse Maven repositories:
- Choose Window > Services from the main menu
and expand the Maven Repositories node to view the contents of the repositories.
The Maven Repositories node in the Services window lists the Maven repositories registered with the IDE and
enables you to add, remove and update Maven repositories.
The local Maven repository is indicated by a yellow repository node
(
)
and remote repositories are indicated by blue repository nodes
(
).
- By default the IDE includes the central Maven repository in the list
of remote repositories.
When a project requires build artifacts that are not stored in the local repository,
Maven downloads the required artifacts to the local repository from a remote repository.
The files in the local Maven repository are then shared by all of your Maven projects.
You can expand the repository nodes to view the indexed artifacts grouped by GroupId and ArtifactId,
the version of the sources and the type of packaging.
Depending on the metadata available, you can right-click an artifact to perform various actions.
- View Details. Opens the Artifact Viewer tab in the editor window.
- Add As Dependency. Choose this to add the library to an open project as a dependency.
The IDE automatically modifies the project's pom.
- Find Usages. Choose this to view open projects and repository artifacts that use
the selected library as a dependency.
- View JavaDoc.
- Open. Opens the project POM in the IDE.
- Download.
- Download Sources.
- Download JavaDoc.
- Copy.
To locate artifacts in the repositories:
- Right-click the Maven Repositories node and choose Find.
- Enter the search term for the artifact in the Find in Repositories dialog box (a groupID, for example)
and select any additional criteria. Click OK.
When you click OK the IDE will create a node for the search term (
)
under the Maven Repositories node.
Expand the search node to view a list of the artifacts that matched your search.
You can remove the search node by right-clicking the node and choosing Delete.
To add a repository:
- Right-click the Maven Repositories node and choose Add Repository.
- Specify the details for the new repository. Click Add.
When you click Add the IDE will create a node for the new repository.
under the Maven Repositories node.
To update the index of a repository:
- Expand the Maven Repositories node, right-click the repository node
you want to update and choose Update Index.
- See Also
- Working with Maven Artifacts
- About Working with Maven
Legal Notices