JAVA-11532 Move maven related modules to maven-modules (#12133)
* JAVA-11532 Move maven related modules to maven-modules * JAVA-11532 Remove moved module from parent pom
This commit is contained in:
7
maven-modules/animal-sniffer-mvn-plugin/README.md
Normal file
7
maven-modules/animal-sniffer-mvn-plugin/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
## Animal Sniffer Maven Plugin
|
||||
|
||||
This module contains articles about the Animal Sniffer Maven Plugin
|
||||
|
||||
### Relevant articles:
|
||||
|
||||
[Introduction to Animal Sniffer Maven Plugin](https://www.baeldung.com/maven-animal-sniffer)
|
||||
49
maven-modules/animal-sniffer-mvn-plugin/pom.xml
Normal file
49
maven-modules/animal-sniffer-mvn-plugin/pom.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>animal-sniffer-mvn-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>animal-sniffer-mvn-plugin</name>
|
||||
<packaging>jar</packaging>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>animal-sniffer-maven-plugin</artifactId>
|
||||
<version>${animal-sniffer-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<signature>
|
||||
<groupId>org.codehaus.mojo.signature</groupId>
|
||||
<artifactId>java16</artifactId>
|
||||
<version>${org.codehaus.mojo.signature.java16.version}</version>
|
||||
</signature>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>animal-sniffer</id>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<animal-sniffer-maven-plugin.version>1.16</animal-sniffer-maven-plugin.version>
|
||||
<org.codehaus.mojo.signature.java16.version>1.0</org.codehaus.mojo.signature.java16.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.baeldung;
|
||||
|
||||
//import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* Hello world!
|
||||
*
|
||||
*/
|
||||
public class App
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
System.out.println( "Hello World!" );
|
||||
//System.out.println(StandardCharsets.UTF_8.name());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.baeldung;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppUnitTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppUnitTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppUnitTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
|
||||
assertTrue( true );
|
||||
|
||||
}
|
||||
}
|
||||
7
maven-modules/maven-archetype/README.md
Normal file
7
maven-modules/maven-archetype/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
## Maven Archetype
|
||||
|
||||
This module contains articles about the Maven Archetype Plugin.
|
||||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Guide to Maven Archetype](https://www.baeldung.com/maven-archetype)
|
||||
29
maven-modules/maven-archetype/pom.xml
Normal file
29
maven-modules/maven-archetype/pom.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?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.baeldung.archetypes</groupId>
|
||||
<artifactId>maven-archetype</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>maven-archetype</name>
|
||||
<packaging>maven-archetype</packaging>
|
||||
<description>Archetype used to generate rest application based on jaxrs 2.1</description>
|
||||
|
||||
<build>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>org.apache.maven.archetype</groupId>
|
||||
<artifactId>archetype-packaging</artifactId>
|
||||
<version>${archetype-packaging.version}</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<archetype-packaging.version>3.0.1</archetype-packaging.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,35 @@
|
||||
<archetype-descriptor
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd
|
||||
http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
|
||||
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
name="microprofile12">
|
||||
|
||||
<requiredProperties>
|
||||
<requiredProperty key="app-path">
|
||||
<defaultValue>resources</defaultValue>
|
||||
</requiredProperty>
|
||||
<requiredProperty key="greeting-msg">
|
||||
<defaultValue>Hi, I was generated from an archetype!</defaultValue>
|
||||
</requiredProperty>
|
||||
<requiredProperty key="liberty-plugin-version">
|
||||
<defaultValue>2.4.2</defaultValue>
|
||||
</requiredProperty>
|
||||
</requiredProperties>
|
||||
|
||||
<fileSets>
|
||||
<fileSet filtered="true" packaged="true">
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.java</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/liberty/config</directory>
|
||||
<includes>
|
||||
<include>server.xml</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
</archetype-descriptor>
|
||||
@@ -0,0 +1,85 @@
|
||||
<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>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<version>${version}</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<build>
|
||||
<finalName>${artifactId}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>net.wasdev.wlp.maven.plugins</groupId>
|
||||
<artifactId>liberty-maven-plugin</artifactId>
|
||||
<version>${liberty-maven-plugin.version}</version>
|
||||
<configuration>
|
||||
<install>
|
||||
<runtimeUrl>
|
||||
https://public.dhe.ibm.com/ibmdl/export/pub/software/openliberty/runtime/nightly/2018-06-18_1442/openliberty-all-20180618-1300.zip
|
||||
</runtimeUrl>
|
||||
</install>
|
||||
<looseApplication>true</looseApplication>
|
||||
<installAppPackages>project</installAppPackages>
|
||||
<configFile>src/main/liberty/config/server.xml</configFile>
|
||||
<stripVersion>true</stripVersion>
|
||||
<bootstrapProperties>
|
||||
<default.http.port>${defaultHttpPort}</default.http.port>
|
||||
<default.https.port>${defaultHttpsPort}</default.https.port>
|
||||
</bootstrapProperties>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install-server</id>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>install-server</goal>
|
||||
<goal>create-server</goal>
|
||||
<goal>install-feature</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>install-apps</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>install-apps</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.enterprise</groupId>
|
||||
<artifactId>cdi-api</artifactId>
|
||||
<version>${cdi.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.ws.rs</groupId>
|
||||
<artifactId>javax.ws.rs-api</artifactId>
|
||||
<version>${rsapi.api.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<liberty-maven-plugin.version>${liberty-plugin-version}</liberty-maven-plugin.version>
|
||||
<defaultHttpPort>9080</defaultHttpPort>
|
||||
<defaultHttpsPort>9443</defaultHttpsPort>
|
||||
<cdi.api.version>2.0</cdi.api.version>
|
||||
<rsapi.api.version>2.1</rsapi.api.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,8 @@
|
||||
package ${package};
|
||||
|
||||
import javax.ws.rs.ApplicationPath;
|
||||
import javax.ws.rs.core.Application;
|
||||
|
||||
@ApplicationPath("${app-path}")
|
||||
public class AppConfig extends Application {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package ${package};
|
||||
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
@Path("ping")
|
||||
public class PingResource {
|
||||
|
||||
@GET
|
||||
public Response get() {
|
||||
return Response.ok("${greeting-msg}").build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<server description="OpenLiberty MicroProfile server">
|
||||
<featureManager>
|
||||
<feature>cdi-2.0</feature>
|
||||
<feature>jaxrs-2.1</feature>
|
||||
</featureManager>
|
||||
<httpEndpoint httpPort="${default.http.port}" httpsPort="${default.https.port}"
|
||||
id="defaultHttpEndpoint" host="*"/>
|
||||
</server>
|
||||
13
maven-modules/maven-archetype/src/main/resources/logback.xml
Normal file
13
maven-modules/maven-archetype/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
</root>
|
||||
</configuration>
|
||||
8
maven-modules/maven-polyglot/README.md
Normal file
8
maven-modules/maven-polyglot/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
## Maven Polyglot
|
||||
|
||||
This module contains articles about Maven Polyglot.
|
||||
|
||||
To run the maven-polyglot-json-app successfully, you first have to build the maven-polyglot-json-extension module using: mvn clean install.
|
||||
|
||||
### Relevant Articles:
|
||||
- [Maven Polyglot](https://www.baeldung.com/maven-polyglot)
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>com.baeldung.maven.polyglot</groupId>
|
||||
<artifactId>maven-polyglot-json-extension</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
@@ -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": "com.baeldung",
|
||||
"artifactId": "parent-boot-2",
|
||||
"version": "0.0.1-SNAPSHOT",
|
||||
"relativePath": "../../parent-boot-2"
|
||||
},
|
||||
"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"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -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 !";
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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.baeldung.maven.polyglot</groupId>
|
||||
<artifactId>maven-polyglot-json-extension</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>maven-polyglot-json-extension</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-core</artifactId>
|
||||
<version>${maven-core.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-metadata</artifactId>
|
||||
<version>${plexus.component.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>generate-metadata</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<maven-core.version>3.5.4</maven-core.version>
|
||||
<plexus.component.version>1.7.1</plexus.component.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -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<String, ?> options) throws IOException, ModelParseException {
|
||||
try (final Reader in = ReaderFactory.newPlatformReader(input)) {
|
||||
return read(in, options);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Model read(Reader reader, Map<String, ?> 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<String, ?> options) throws IOException, ModelParseException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<extensions>
|
||||
<extension>
|
||||
<groupId>io.takari.polyglot</groupId>
|
||||
<artifactId>polyglot-yaml</artifactId>
|
||||
<version>0.3.1</version>
|
||||
</extension>
|
||||
</extensions>
|
||||
13
maven-modules/maven-polyglot/maven-polyglot-yml-app/pom.yml
Normal file
13
maven-modules/maven-polyglot/maven-polyglot-yml-app/pom.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
modelVersion: 4.0.0
|
||||
groupId: com.baeldung.maven.polyglot
|
||||
artifactId: maven-polyglot-yml-app
|
||||
version: 1.0-SNAPSHOT
|
||||
name: 'YAML Demo'
|
||||
|
||||
parent:
|
||||
groupId: "com.baeldung"
|
||||
artifactId: "parent-modules"
|
||||
version: "1.0.0-SNAPSHOT"
|
||||
relativePath: "../.."
|
||||
|
||||
properties: {maven.compiler.source: 1.8, maven.compiler.target: 1.8}
|
||||
@@ -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 !");
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
23
maven-modules/maven-polyglot/pom.xml
Normal file
23
maven-modules/maven-polyglot/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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>
|
||||
<artifactId>maven-polyglot</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>maven-polyglot</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>maven-modules</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<!-- <module>maven-polyglot-json-app</module> --> <!-- Not a maven project -->
|
||||
<module>maven-polyglot-json-extension</module>
|
||||
<!-- <module>maven-polyglot-yml-app</module> --> <!-- Not a maven project -->
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
@@ -15,6 +15,8 @@
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>animal-sniffer-mvn-plugin</module>
|
||||
<module>maven-archetype</module>
|
||||
<!-- <module>compiler-plugin-java-9</module> --> <!-- We haven't upgraded to java 9. -->
|
||||
<module>maven-copy-files</module>
|
||||
<module>maven-custom-plugin</module>
|
||||
@@ -23,6 +25,7 @@
|
||||
<module>maven-integration-test</module>
|
||||
<module>maven-multi-source</module>
|
||||
<module>maven-plugins</module>
|
||||
<module>maven-polyglot</module>
|
||||
<module>maven-properties</module>
|
||||
<!-- <module>maven-proxy</module> --> <!-- Not a maven project -->
|
||||
<module>maven-unused-dependencies</module>
|
||||
|
||||
Reference in New Issue
Block a user