User Tools

Site Tools


maven

Maven is a dependency manager. It is built on the Project Object Model (POM). It consists on a xml file, where all dependencies are written down and there with the command mvn you can manage the project. There are goals that can be invoked from the command line as an argument.

Extraído del libro Apache Maven 3 Cookbook

groupID: raiz del package en el que se almacena la aplicación “com.mycompany.app”

artifactID: Nombre o identificador del proyecto “my-app”, es el directorio donde se almacenará

CLASSPATH

scope

compile

If none is specified, this one is ussed. The dependency is available in all classpath of the proyect and the dependencies are propagated among dependent projects

provided

The difference with compile is that it is supposed to be provided at runtime by the system, not by your application, so it has not to be packaged in your deployment. It is not transitive and only available in compilation and test classpath

runtime

It means that the dependency is not required for compilation but for execution. It works in the runtime and test classpaths but not in the compile classpath.

test

The dependency with this scope is not required for normal use of the application, and it is only available for the test classpath. It is not transitive

system

Instead of provide the dependency by the system, you in the body of the dependency specify the path to it. It is attached to the deployment

import

Under this scope, the dependencies inside the tag <dependencyManagement> section are copied to where this dependency is (based on the groupId and the artifactId).

Dependencies

H2 database and jpa

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <scope>runtime</scope>
</dependency>

If instead of H2 database it is needed mysql:

<dependency>
  <groupId>mysql</groupId>
  <artifactId>mysql-connector-java</artifactId>
  <scope>runtime</scope>
</dependency>
maven.txt · Last modified: 2020/07/07 07:56 by admin