How do you specify a repository in Maven?
A) By adding a
<repository>
element within the <repositories>
sectionB) By adding a
<pluginRepository>
element within the <repositories>
sectionC) By adding a
<dependency>
element within the <repositories>
sectionD) By adding a
<plugin>
element within the <repositories>
sectionAnswer:
A) By adding a
<repository>
element within the <repositories>
sectionExplanation:
To specify a repository in Maven, you add a <repository>
element within the <repositories>
section of the pom.xml
file. This element defines the URL of the repository where Maven should look for project dependencies.
For example:
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
In this example, the Maven Central Repository is specified as the source for dependencies.