How to configure Flyway for multimodule project? - spring

I have a multimodule project where one of the modules is responsible for handling my migrations, so my project structure looks like this:
project
|
|-> application
|-> approval-management
|-> database
|-> security
...
My pom.xml for database module looks like this:
<?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>
<artifactId>application</artifactId>
<groupId>com.test</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>database</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<profiles>
<profile>
<id>local</id>
<properties>
<activatedProperties>local</activatedProperties>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<activatedProperties>test</activatedProperties>
</properties>
</profile>
</profiles>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.1.2.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>5.1.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<scope>compile</scope> <!-- use compile, as we also use H2 locally to run it -->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.3.7.Final</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>application</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>5.2.4</version>
</plugin>
</plugins>
</build>
My migration scripts are in folder: database.serc.main.resources.db.migration
and look like this: V1.0.1.001__TABLE.sql(my schema is empty)
now since im using profiles for this case i will use default local profile which uses application-local.properties
application-local.properties in module database are as follows:
spring.h2.console.settings.trace=false
spring.h2.console.enabled=true
spring.datasource.platform=h2
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=none
spring.datasource.initialize=false
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
## FlyWay
flyway.enabled=true
flyway.baselineOnMigrate=false
flyway.table=FLYWAY_SCHEMA_HISTORY
flyway.locations=classpath:db/migration
flyway.h2ConsoleEnabled=true
flyway.h2Port=8011
flyway.sqlMigrationPrefix=V
flyway.sqlMigrationSeparator=__
flyway.sqlMigrationSuffix=.sql
flyway.validateOnMigrate=true
Now from this configuration i would expect that while running my application flyway would be automaticly triggered and run migration, however its not (Fly way is not even visible anywhere in logs).
Moreover, when i tried to run execution of migration from commandline using:
mvn compile flyway:migrate
this results in error:
Failed to execute goal org.flywaydb:flyway-maven-plugin:5.2.4:migrate (default-cli) on project application: org.flywaydb.core.api.FlywayException: Unable to connect to the database. Configure the url, user and password!
now since everything is configured under application-local.properties i guess my properties are not picked-up somehow, yet i fail to see where the problem is, please take a look and tell my where have i made mistake?
PS. in previous projects (withoud module breakdown, but with profiles as well) the exact same configuration worked just fine

Related

Camunda, Wont deploy to Tomcat

I am trying to create a complete instance of Camunda (cockpit, andmin, tasklist, engine-rest, ... ).
I have created a project using their archtype and ran it successfully using maven springboot:run
But when trying to deploy the project to a Tomcat server. I face the issue of the project being inaccessible.
I have the following pom.xml
<?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>
<groupId>com.myapplication.camunda</groupId>
<artifactId>camunda-all</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Camunda Spring Boot Application</name>
<description>Spring Boot Application using [Camunda](http://docs.camunda.org). [The project has been generated by the Maven archetype 'camunda-archetype-spring-boot-7.9.2']</description>
<packaging>war</packaging>
<properties>
<camunda.version>7.9.0</camunda.version>
<!--
Adjust if you want to use Camunda Enterprise Edition (EE):
<camunda.version>7.9.0-ee</camunda.version>
Make sure you also switch to the ee webapp dependency
and EE repository below
-->
<camundaSpringBoot.version>3.0.0</camundaSpringBoot.version>
<springBoot.version>2.0.2.RELEASE</springBoot.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.java>1.8</version.java>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-bom</artifactId>
<version>${camunda.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.camunda.bpm.dmn</groupId>
<artifactId>camunda-engine-dmn-bom</artifactId>
<version>${camunda.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springBoot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<!--
Adjust if you want to use EE:
<artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
Make sure you also use an EE version of Camunda - see above
-->
<version>${camundaSpringBoot.version}</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>${camundaSpringBoot.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- required to use H2 as a file based database (Otherwise it's In-Memory) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Required to use Spin dataformat support -->
<dependency>
<groupId>org.camunda.spin</groupId>
<artifactId>camunda-spin-dataformat-all</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-plugin-spin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert-scenario</artifactId>
<version>0.2</version>
<scope>test</scope>
</dependency>
<!-- Used to generate test coverage reports, see https://github.com/camunda/camunda-consulting/tree/master/snippets/camunda-bpm-process-test-coverage -->
<!--
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-process-test-coverage</artifactId>
<version>0.3.2</version>
<scope>test</scope>
</dependency> -->
<!-- java util logging => slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<!-- Add your own dependencies here, if in compile scope, they are added to the jar -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<!-- <version>2.4.0-b180725.0427</version>-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<!-- <version>4.5.2</version>-->
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>camunda-bpm-nexus</id>
<name>Camunda Maven Repository</name>
<url>https://app.camunda.com/nexus/content/groups/public</url>
</repository>
<!-- enable this for EE dependencies (requires credentials in ~/.m2/settings.xml)
<repository>
<id>camunda-bpm-nexus-ee</id>
<name>Camunda Enterprise Maven Repository</name>
<url>https://app.camunda.com/nexus/content/repositories/camunda-bpm-ee</url>
</repository>
-->
</repositories>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springBoot.version}</version>
<configuration>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.myapplication.camunda.CamundaApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I have the following application class
package com.myapplication.camunda;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication
#EnableProcessApplication("camunda-all")
#ComponentScan("com.myapplication.camunda")
#ComponentScan("com.springboot.camunda")
public class CamundaApplication extends SpringBootServletInitializer {
public static void main(String... args) {
SpringApplication.run(CamundaApplication.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CamundaApplication.class);
}
}
The following application.yaml
spring.datasource:
url: jdbc:postgresql://localhost:5432/camunda_db?autoReconnect=true
username: postgres
password: postgres
driver-class-name: org.postgresql.Driver
spring.h2.console.enabled: true
camunda.bpm:
admin-user:
id: demo
password: demo
firstName: Demo
filter:
create: All tasks
server.port: 8080
server:
servlet:
context-path: /camunda-all
I have the main/resources/webapp directory empty.
I would really appreciate any help.
Created empty maven project
added files you posted above
adjusted db settings to my postgres
cmd: mvn spring-boot:run
Portal is accessible under http://localhost:8080/camunda-all
Then adjusted POM for external tomcat deployment (also upgraded versions and cleanup up).
Updated result here:
https://github.com/rob2universe/stackoverflow58356978
there are couple of things to do to deploy you war in camunda application server.
add required dependency in pom.xml file
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<version>7.13.0</version>
<scope>provided</scope>
</dependency>
Replace #EnableProcessApplication("camunda-all") with #ProcessApplication("camunda-all")
extend your main class with ServletProcessApplication not with SpringBootServletInitializer.
Added your BPMN file in process.xml file which is inside resources/META-INF folder.
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-archive>
<process-engine>default</process-engine>
<resource>invoice.v2.bpmn</resource>
<resource>invoiceBusinessDecisions.dmn</resource>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">false</property>
</properties>
</process-archive>
</process-application>

Error when deploy Spring Boot application in Google AppEngine + Non Zero Exit 2

I am getting below error when deploying my test maven Spring Boot REST app in GAE -
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.0.0-rc5:deploy (default-cli) on project PublicLibrary: App Engine application deployment failed: com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.AppEngineException: Non zero exit: 2 -> [Help 1]
App.yaml looks like
runtime: java
env: flex
runtime_config:
jdk: openjdk8
env_variables:
SPRING_PROFILES_ACTIVE: "gcp"
handlers:
- url: /.*
script: this field is required, but ignored
manual_scaling:
instances: 1
pom.xml
<?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>com.publiclibrary</groupId>
<artifactId>PublicLibrary</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>PublicLibrary</name>
<description>Demo project for Spring data relationship</description>
<properties>
<java.version>1.8</java.version>
</properties>
<profiles>
<profile>
<id>cloud-gcp</id>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.0.0-rc5</version>
<configuration>
<deploy.projectId>libraryapi-03312019</deploy.projectId>
<deploy.version>1.0</deploy.version>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I would appreciate any help.
Check the official Springboot sample of Google Cloud Platform to see what you might be doing different.
For example, I see that in the <properties> section it requires <maven.compiler.source> and <maven.compiler.target>:
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <!-- REQUIRED -->
<maven.compiler.target>${java.version}</maven.compiler.target> <!-- REQUIRED -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<appengine.maven.plugin>1.3.2</appengine.maven.plugin>
</properties>
Note that you are using version 2.0.0-rc5 for the appengine-maven-plugin so if you add it in the properties like above you should use the same version as in the plugin section:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin}</version>
</plugin>
Thanks. I followed the sample app and add the differences to my pom.xml. That alone didn't fix the issue. Additionally, I added legacy health checks that to app.yaml that allowed to deploy the app (which took quite some time) -
health_check:
enable_health_check: True
check_interval_sec: 5
timeout_sec: 4
unhealthy_threshold: 2
healthy_threshold: 2
But after deployment when I try to access the app as https://< project-id>:appspot.com I get below error -
Error: Server Error
The server encountered a temporary error and could not complete your request.
Please try again in 30 seconds.
UPDATE
I added the resources section to app.yaml as in GAE Java is known to consume high memory as identified in this article
resources:
cpu: 2
memory_gb: 2.3
disk_size_gb: 10
volumes:
- name: ramdisk1
volume_type: tmpfs
size_gb: 0.5

Error in the pom.xml generated by Spring Initializr

I'm using Spring Tool Suite, and I want to make a REST API with Kotlin, Spring and Maven, but my pom.xml has an error after create the project via Spring Initializr. My "parent" tag raise an error, but I guess the problem come from the kotlin-maven-plugin. I can't figure what's wrong with this pom.xml. If someone could help me fixing this, I'll be grateful!
Here's my pom.xml:
<?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>
<groupId>fr.asi</groupId>
<artifactId>api_kotlin_test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>api_kotlin_test</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<kotlin.version>1.2.51</kotlin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<configuration>
<args>
<arg>-Xjsr305=strict</arg>
</args>
<compilerPlugins>
<plugin>spring</plugin>
<plugin>jpa</plugin>
</compilerPlugins>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-noarg</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
And I have this error:
Project configurator "org.jetbrains.kotlin.maven.projectConfigurator" required by plugin execution "org.jetbrains.kotlin:kotlin-maven-plugin:1.2.51:test-compile (execution: test-compile, phase: test-compile)" is not available. To enable full functionality, install the project configurator and run Maven->Update Project Configuration.
I add a property in the pom.xml as below:
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
After adding this property, just save your pom.xml and update your project. The error should be resolved.
Below is a snippet from the pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.in28minutes.learning.jpa</groupId>
<artifactId>jpa-in-10-steps</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jpa-in-10-steps</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
I removed the error by adding a "plugingManagement" tag to enclose the "plugins" tags like following:
<pluginManagement>
<plugins>
.......
</plugins>
</pluginManagement>
Note: This changing just removed the error, but I'm still unable to run the code (the "Run as Kotlin Application" option in Eclipse doesn't exist in my case.) I'm not sure if those errors are related, but I can't confirm they're not.
Edit: I just avoid this issue by switching my IDE to IntelliJ IDEA, it seems that the Kotlin plugin of Eclipse is not perfect for now... All is fine now, and the "pluginManagement" tag is useless now.

Spring Camel: Process finished with exit code 0

I am trying to integrate camel into an existing spring project that uses an embedded tomcat instance to run locally. The spring project works before I add any camel dependencies, however, after 4 camel dependencies are added, I get the message "Process finished with exit code 0". I am building the application with maven and running it inside an embedded tomcat instance (mvn clean install -Pembedded (see profile below)).
I am not a Camel newbie, but I still cant figure out how the dependencies below are causing my spring process to finish running (it seems like spring sees nothing to execute after the camel dependencies are added). How can I keep the existing spring application working and still have the new camel dependencies?
Here are the new dependencies:
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws</artifactId>
<version>2.19.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
Here is the complete file (with private info removed):
<?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>com.----.----</groupId>
<artifactId>webs-parent</artifactId>
<version>1.0.6-SNAPSHOT</version>
</parent>
<artifactId>webs-catalog</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>${packaging.type}</packaging>
<name>catalog-service</name>
<description>Commerce Catalog Service</description>
<url>----</url>
<properties>
<jacoco.minimum.code.coverage>0.8</jacoco.minimum.code.coverage>
<packaging.type>war</packaging.type>
<failOnMissingWebXml>false</failOnMissingWebXml>
<central.repo>----</central.repo> <!-- "nexus-proxy" is a cache -->
<org.apache.camel.version>2.16.0</org.apache.camel.version>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-aws</artifactId>
<version>2.19.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
<version>${org.apache.camel.version}</version>
</dependency>
</dependencies>
<profiles>
<!-- Default build profile for generating war -->
<profile>
<id>war</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<packaging.type>war</packaging.type>
<log.dir>${catalina.base}/logs</log.dir>
<!-- updates bootstrap.properties -->
<config.override.path>file:${catalina.base}/conf</config.override.path>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptor>/src/main/resources/deployablecontent.xml</descriptor>
<tarLongFileMode>posix</tarLongFileMode>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Build profile for stand-alone java application with embedded Tomcat
Container -->
<profile>
<id>embedded</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<packaging.type>jar</packaging.type>
<log.dir>logs</log.dir>
<!-- updates bootstrap.properties -->
<config.override.path>./conf</config.override.path>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>central-mirror</id>
<url>${central.repo}</url>
</repository>
</repositories>
Remove the provided scope for spring-boot-starter-tomcat then it become default scope compile. In embedded tomcat environment, You should set default scope compile and if you wish to deploy the war to any other standalone tomcat. This dependency can be marked as provided.

How to use maven package a war with taglibs like jstl and spring?

maven+spring boot
when I type mvn spring-boot:run
that is ok without anyerror
but when I type mvn package
server throws a exception
org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application
my pom
and I want to know what should I do to resolve this problem
any master can help me?
<?xml version="1.0" encoding="UTF-8"?>
<project mlns="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>
<groupId>com.example</groupId>
<artifactId>myproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.2.BUILD-SNAPSHOT</version>
</parent>
<properties>
<java.version>1.7</java.version>
</properties>
<!-- Additional lines to be added here... -->
<dependencies>
<!--developing a web application -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Import Spring Boot’s default HTTP engine (Tomcat) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<scope>provided</scope>
</dependency>
<!-- Support for common test dependencies, including JUnit, Hamcrest and
Mockito along with the spring-test module. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!--To add this blowe to create an executable jar -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Try adding below dependency to your pom.xml
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>Your Security Version</version>
</dependency>
Another point to be noted, instead of mvn mvn package type mvn package

Resources