This commit is contained in:
eelhazati 2018-06-24 23:24:49 +01:00 committed by Predrag Maric
parent 1024102d9a
commit 32d50befa4
7 changed files with 182 additions and 1 deletions

29
maven-archetype/pom.xml Normal file
View 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>
<packaging>maven-archetype</packaging>
<description>Archetype used to generate rest application based on jaxrs 2.1</description>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>3.0.1</version>
</extension>
</extensions>
<!--....-->
</build>
</project>

View File

@ -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>

View File

@ -0,0 +1,82 @@
<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>
<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>
</properties>
<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>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -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 {
}

View File

@ -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();
}
}

View File

@ -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>

View File

@ -266,7 +266,8 @@
<module>twilio</module>
<module>spring-boot-ctx-fluent</module>
<module>java-ee-8-security-api</module>
<module>spring-webflux-amqp</module>
<module>spring-webflux-amqp</module>
<module>maven-archetype</module>
</modules>
<dependencies>