So I'm trying to follow along with this tutorial.
I usually work with Gradle, so I'm not too savvy about maven plugins, but there's not much Gradle to be had out there, so ... Maven it is.
But when IntelliJ protested it couldn't find the properties-maven-plugin
when I added it, I did some googling and found this answer which suggested I needed to check IntelliJ's use plugin registry
maven setting.
I did, and IntlliJ accepted the plugin. Great, let's add the next ...
Plugin 'org.codehaus.mojo:sql-maven-plugin:1.5' not found
with both the name and the version number displayed in red.
Well, isn't that great? -.- THERE it is, bloody use it, already!
I'd really appreciate it if somebody could tell me what I need to do to add the plugins correctly, because I cannot find that information on the
Here's the POM.xml
, so far (and I also intend to add the third plugin mentioned on the tutorial, as soon as I got this one to work).
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>some.where</groupId>
<artifactId>foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>foo</name>
<description>Simple project to test Spring Boot and JOOQ</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--
Note: to add the following plugins in IntelliJ, go into IntelliJ's Maven settings and check the
'use plugin registry'
option
-->
<plugin>
<!--https://www.baeldung.com/jooq-with-spring:
This plugin is used to read configuration data from a resource file.
It is not required since the data may be directly added to the POM,
but it is a good idea to manage the properties externally.
(Here: it's reading the `application.properties` file)
The read-project-properties goal of this plugin should be bound to an early phase
so that the configuration data can be prepared for use by other plugins.
In this case, it is bound to the initialize phase.
In it, we'll define properties for database connections, including the
JDBC driver class,
database URL,
username,and
password
-->
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>src/main/resources/application.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<!-- now WHY won't the plugin work THIS time ?! -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<driver>${db.driver}</driver>
<url>${db.url}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<srcFiles>
<srcFile>src/main/resources/intro_schema.sql</srcFile>
</srcFiles>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
(It also cannot find the H2 version in the plugin so I just removed the <version>1.4.191</version>
when compared to the tutorial code, since there's also a dependency inserted by the SpringInitializr that doesn't mention a version number either.)