diff --git a/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml b/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml
new file mode 100644
index 0000000000..c06b76e1b2
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/.mvn/extensions.xml
@@ -0,0 +1,8 @@
+
+
+
+ com.baeldung.maven.polyglot
+ maven-polyglot-json-extension
+ 1.0-SNAPSHOT
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-app/pom.json b/maven-polyglot/maven-polyglot-json-app/pom.json
new file mode 100644
index 0000000000..abd58f3127
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/pom.json
@@ -0,0 +1,34 @@
+{
+ "modelVersion": "4.0.0",
+ "groupId": "com.baeldung.maven.polyglot",
+ "artifactId": "maven-polyglot-json-app",
+ "version": "1.0-SNAPSHOT",
+ "name": "Json Maven Polyglot",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": null
+ },
+ "properties": {
+ "project.build.sourceEncoding": "UTF-8",
+ "project.reporting.outputEncoding": "UTF-8",
+ "maven.compiler.source": "1.8",
+ "maven.compiler.target": "1.8",
+ "java.version": "1.8"
+ },
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web"
+ }
+ ],
+ "build": {
+ "plugins": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-maven-plugin"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java b/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java
new file mode 100644
index 0000000000..d03116889f
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/src/main/java/com/baeldung/maven/polyglot/MavenPolyglotApplication.java
@@ -0,0 +1,19 @@
+package com.baeldung.maven.polyglot;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@RestController
+@SpringBootApplication
+public class MavenPolyglotApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(MavenPolyglotApplication.class, args);
+ }
+
+ @GetMapping("/")
+ public String home(){
+ return "Hello JSON Maven Model !";
+ }
+}
diff --git a/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json b/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json
new file mode 100644
index 0000000000..f006582c12
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-app/src/main/resources/model.json
@@ -0,0 +1,109 @@
+{
+ "modules": [],
+ "distributionManagement": null,
+ "properties": {
+ "project.reporting.outputEncoding": "UTF-8",
+ "java.version": "1.8",
+ "maven.compiler.source": "1.8",
+ "project.build.sourceEncoding": "UTF-8",
+ "maven.compiler.target": "1.8"
+ },
+ "dependencyManagement": null,
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web",
+ "version": null,
+ "type": "jar",
+ "classifier": null,
+ "scope": null,
+ "systemPath": null,
+ "exclusions": [],
+ "optional": null,
+ "managementKey": "org.springframework.boot:spring-boot-starter-web:jar"
+ }
+ ],
+ "repositories": [],
+ "pluginRepositories": [],
+ "reports": null,
+ "reporting": null,
+ "modelVersion": "4.0.0",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": "",
+ "id": "org.springframework.boot:spring-boot-starter-parent:pom:2.0.5.RELEASE"
+ },
+ "groupId": "com.demo.polyglot",
+ "artifactId": "maven-polyglot-app",
+ "version": "1.0.1",
+ "packaging": "jar",
+ "name": "Json Maven Polyglot",
+ "description": null,
+ "url": null,
+ "inceptionYear": null,
+ "organization": null,
+ "licenses": [],
+ "developers": [],
+ "contributors": [],
+ "mailingLists": [],
+ "prerequisites": null,
+ "scm": null,
+ "issueManagement": null,
+ "ciManagement": null,
+ "build": {
+ "plugins": [
+ {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ ],
+ "pluginManagement": null,
+ "defaultGoal": null,
+ "resources": [],
+ "testResources": [],
+ "directory": null,
+ "finalName": null,
+ "filters": [],
+ "sourceDirectory": null,
+ "scriptSourceDirectory": null,
+ "testSourceDirectory": null,
+ "outputDirectory": null,
+ "testOutputDirectory": null,
+ "extensions": [],
+ "pluginsAsMap": {
+ "org.liquibase:liquibase-maven-plugin": {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ }
+ },
+ "profiles": [],
+ "modelEncoding": "UTF-8",
+ "pomFile": null,
+ "id": "com.demo.polyglot:maven-polyglot-app:jar:1.0.1",
+ "projectDirectory": null
+}
diff --git a/maven-polyglot/maven-polyglot-json-extension/pom.xml b/maven-polyglot/maven-polyglot-json-extension/pom.xml
new file mode 100644
index 0000000000..d5c5b7ab55
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-extension/pom.xml
@@ -0,0 +1,47 @@
+
+
+ 4.0.0
+
+ com.baeldung.maven.polyglot
+ maven-polyglot-json-extension
+ 1.0-SNAPSHOT
+
+
+ 1.8
+ 1.8
+
+
+
+
+ org.apache.maven
+ maven-core
+ 3.5.4
+ provided
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.9.6
+
+
+
+
+
+
+ org.codehaus.plexus
+ plexus-component-metadata
+ 1.7.1
+
+
+
+ generate-metadata
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java b/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java
new file mode 100644
index 0000000000..a1756192e9
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-json-extension/src/main/java/com/demo/polyglot/CustomModelProcessor.java
@@ -0,0 +1,62 @@
+package com.demo.polyglot;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.building.FileModelSource;
+import org.apache.maven.model.building.ModelProcessor;
+import org.apache.maven.model.io.ModelParseException;
+import org.apache.maven.model.io.ModelReader;
+import org.codehaus.plexus.component.annotations.Component;
+import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.util.ReaderFactory;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.util.Map;
+
+@Component(role = ModelProcessor.class)
+public class CustomModelProcessor implements ModelProcessor {
+
+ private static final String XML_POM = "pom.xml";
+ private static final String JSON_POM = "pom.json";
+ private static final String JSON_EXT = ".json";
+
+ ObjectMapper objectMapper = new ObjectMapper();
+
+ @Requirement
+ private ModelReader modelReader;
+
+ @Override
+ public File locatePom(File projectDirectory) {
+ File pomFile = new File(projectDirectory, JSON_POM);
+ if (!pomFile.exists()) {
+ pomFile = new File(projectDirectory, XML_POM);
+ }
+ return pomFile;
+ }
+
+ @Override
+ public Model read(InputStream input, Map options) throws IOException, ModelParseException {
+ try (final Reader in = ReaderFactory.newPlatformReader(input)) {
+ return read(in, options);
+ }
+ }
+
+ @Override
+ public Model read(Reader reader, Map options) throws IOException, ModelParseException {
+ FileModelSource source = (options != null) ? (FileModelSource) options.get(SOURCE) : null;
+ if (source != null && source.getLocation().endsWith(JSON_EXT)) {
+ Model model = objectMapper.readValue(reader, Model.class);
+ return model;
+ }
+ //It's a normal maven project with a pom.xml file
+ return modelReader.read(reader, options);
+ }
+
+ @Override
+ public Model read(File input, Map options) throws IOException, ModelParseException {
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml b/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml
new file mode 100644
index 0000000000..cfc6275681
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/.mvn/extensions.xml
@@ -0,0 +1,8 @@
+
+
+
+ io.takari.polyglot
+ polyglot-yaml
+ 0.3.1
+
+
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/pom.yml b/maven-polyglot/maven-polyglot-yml-app/pom.yml
new file mode 100644
index 0000000000..445e2eec3b
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/pom.yml
@@ -0,0 +1,7 @@
+modelVersion: 4.0.0
+groupId: com.baeldung.maven.polyglot
+artifactId: maven-polyglot-yml-app
+version: 1.0-SNAPSHOT
+name: 'YAML Demo'
+
+properties: {maven.compiler.source: 1.8, maven.compiler.target: 1.8}
\ No newline at end of file
diff --git a/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java b/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java
new file mode 100644
index 0000000000..2142c7f9b8
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/src/main/java/com/baeldung/maven/polyglot/YamlDemoApplication.java
@@ -0,0 +1,7 @@
+package com.baeldung.maven.polyglot;
+
+public class YamlDemoApplication {
+ public static void main(String[] args) {
+ System.out.println("Hello Maven Polyglot YAML !");
+ }
+}
diff --git a/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json b/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json
new file mode 100644
index 0000000000..f006582c12
--- /dev/null
+++ b/maven-polyglot/maven-polyglot-yml-app/src/main/resources/model.json
@@ -0,0 +1,109 @@
+{
+ "modules": [],
+ "distributionManagement": null,
+ "properties": {
+ "project.reporting.outputEncoding": "UTF-8",
+ "java.version": "1.8",
+ "maven.compiler.source": "1.8",
+ "project.build.sourceEncoding": "UTF-8",
+ "maven.compiler.target": "1.8"
+ },
+ "dependencyManagement": null,
+ "dependencies": [
+ {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-web",
+ "version": null,
+ "type": "jar",
+ "classifier": null,
+ "scope": null,
+ "systemPath": null,
+ "exclusions": [],
+ "optional": null,
+ "managementKey": "org.springframework.boot:spring-boot-starter-web:jar"
+ }
+ ],
+ "repositories": [],
+ "pluginRepositories": [],
+ "reports": null,
+ "reporting": null,
+ "modelVersion": "4.0.0",
+ "parent": {
+ "groupId": "org.springframework.boot",
+ "artifactId": "spring-boot-starter-parent",
+ "version": "2.0.5.RELEASE",
+ "relativePath": "",
+ "id": "org.springframework.boot:spring-boot-starter-parent:pom:2.0.5.RELEASE"
+ },
+ "groupId": "com.demo.polyglot",
+ "artifactId": "maven-polyglot-app",
+ "version": "1.0.1",
+ "packaging": "jar",
+ "name": "Json Maven Polyglot",
+ "description": null,
+ "url": null,
+ "inceptionYear": null,
+ "organization": null,
+ "licenses": [],
+ "developers": [],
+ "contributors": [],
+ "mailingLists": [],
+ "prerequisites": null,
+ "scm": null,
+ "issueManagement": null,
+ "ciManagement": null,
+ "build": {
+ "plugins": [
+ {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ ],
+ "pluginManagement": null,
+ "defaultGoal": null,
+ "resources": [],
+ "testResources": [],
+ "directory": null,
+ "finalName": null,
+ "filters": [],
+ "sourceDirectory": null,
+ "scriptSourceDirectory": null,
+ "testSourceDirectory": null,
+ "outputDirectory": null,
+ "testOutputDirectory": null,
+ "extensions": [],
+ "pluginsAsMap": {
+ "org.liquibase:liquibase-maven-plugin": {
+ "inherited": null,
+ "configuration": null,
+ "inheritanceApplied": true,
+ "groupId": "org.liquibase",
+ "artifactId": "liquibase-maven-plugin",
+ "version": "3.0.5",
+ "extensions": null,
+ "executions": [],
+ "dependencies": [],
+ "goals": null,
+ "key": "org.liquibase:liquibase-maven-plugin",
+ "id": "org.liquibase:liquibase-maven-plugin:3.0.5",
+ "executionsAsMap": {}
+ }
+ }
+ },
+ "profiles": [],
+ "modelEncoding": "UTF-8",
+ "pomFile": null,
+ "id": "com.demo.polyglot:maven-polyglot-app:jar:1.0.1",
+ "projectDirectory": null
+}