Removed the legacy extensions.json and enahanced the platform json descriptor loader to load the default version from the classpath

This commit is contained in:
Alexey Loubyansky
2019-10-26 01:18:38 +02:00
committed by Max Rydahl Andersen
parent fc6f867721
commit 4ec22be050
109 changed files with 2219 additions and 1416 deletions

View File

@@ -100,21 +100,11 @@
<artifactId>quarkus-platform-descriptor-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-templates</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-creator</artifactId>

View File

@@ -12,7 +12,7 @@
<artifactId>quarkus-bom-descriptor-json</artifactId>
<packaging>pom</packaging>
<name>Quarkus - Core Extensions JSON</name>
<name>Quarkus - BOM - Descriptor JSON</name>
<dependencies>
</dependencies>
@@ -21,7 +21,8 @@
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<artifactId>quarkus-platform-descriptor-json-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<phase>process-resources</phase>

View File

@@ -23,7 +23,7 @@ repositories {
dependencies {
compile "io.quarkus:quarkus-bootstrap-core:${version}"
compile "io.quarkus:quarkus-devtools-common:${version}"
compile "io.quarkus:quarkus-platform-descriptor-legacy:${version}"
compile "io.quarkus:quarkus-platform-descriptor-json:${version}"
compile "io.quarkus:quarkus-development-mode:${version}"
compile "io.quarkus:quarkus-creator:${version}"
compile "org.gradle:gradle-tooling-api:5.5.1"

View File

@@ -54,19 +54,17 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-development-mode</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-creator</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
</dependency>
<dependency>

View File

@@ -32,10 +32,6 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json</artifactId>

View File

@@ -61,12 +61,6 @@ public class CreateProjectMojo extends AbstractMojo {
final private static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
private static String pluginKey;
public static String getPluginKey() {
return pluginKey == null ? pluginKey = MojoUtils.getPluginGroupId() + ":" + MojoUtils.getPluginArtifactId() : pluginKey;
}
private static final String DEFAULT_GROUP_ID = "org.acme.quarkus.sample";
@Parameter(defaultValue = "${project}")

View File

@@ -1,11 +1,9 @@
package io.quarkus.maven;
import java.io.InputStream;
import java.net.URL;
import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
@@ -27,11 +25,11 @@ import org.w3c.dom.NodeList;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.bootstrap.util.ZipUtils;
import io.quarkus.maven.utilities.MojoUtils;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
import io.quarkus.platform.descriptor.loader.json.impl.QuarkusJsonPlatformDescriptorLoaderBootstrap;
import io.quarkus.platform.descriptor.loader.json.util.QuarkusJsonDescriptorUtils;
import io.quarkus.platform.descriptor.loader.legacy.QuarkusLegacyPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.legacy.QuarkusLegacyPlatformDescriptorLoader;
import io.quarkus.platform.tools.MessageWriter;
import io.quarkus.platform.tools.config.QuarkusPlatformConfig;
import io.quarkus.platform.tools.maven.MojoMessageWriter;
@@ -57,6 +55,14 @@ public final class CreateUtils {
final Log log)
throws MojoExecutionException {
final Artifact platformArtifact = new DefaultArtifact(platformGroupId, platformArtifactId, null, "json",
defaultPlatformVersion);
if (isOnClasspath(platformArtifact)) {
loadDescriptorFromClasspath(log);
return;
}
final MavenArtifactResolver mvn;
try {
mvn = MavenArtifactResolver.builder()
@@ -68,68 +74,73 @@ public final class CreateUtils {
throw new MojoExecutionException("Failed to initialize artifact resolver", e);
}
final Artifact platformArtifact = new DefaultArtifact(platformGroupId, platformArtifactId, null, "json",
defaultPlatformVersion);
setupQuarkusJsonPlatformDescriptor(mvn, platformArtifact, log);
doSetupQuarkusJsonPlatformDescriptor(mvn, platformArtifact, log);
}
public static void setupQuarkusJsonPlatformDescriptor(MavenArtifactResolver mvn, Artifact platformArtifact, final Log log)
throws MojoExecutionException {
if (isOnClasspath(platformArtifact)) {
loadDescriptorFromClasspath(log);
return;
}
doSetupQuarkusJsonPlatformDescriptor(mvn, platformArtifact, log);
}
private static void doSetupQuarkusJsonPlatformDescriptor(MavenArtifactResolver mvn, Artifact platformArtifact,
final Log log)
throws MojoExecutionException {
if (platformArtifact.getVersion() == null || platformArtifact.getVersion().isEmpty()) {
platformArtifact = platformArtifact.setVersion(resolvePluginInfo(CreateUtils.class).getVersion());
}
final MessageWriter msgWriter = new MojoMessageWriter(log);
QuarkusPlatformDescriptor platformDescr;
final QuarkusPlatformDescriptor platformDescr;
try {
platformDescr = QuarkusJsonDescriptorUtils.loadDescriptor(mvn, platformArtifact, msgWriter);
platformDescr = QuarkusJsonDescriptorUtils.loadDescriptor(mvn, platformArtifact, new MojoMessageWriter(log));
} catch (Throwable t) {
log.warn(
"The JSON platform descriptor couldn't be loaded for " + platformArtifact
+ ". Falling back to the legacy platform descriptor.");
platformDescr = newLegacyDescriptor(msgWriter);
throw new MojoExecutionException("Failed to resolve platform descriptor " + platformArtifact, t);
}
QuarkusPlatformConfig.defaultConfigBuilder()
.setPlatformDescriptor(platformDescr)
.build();
}
public static void setupQuarkusLegacyPlatformDescriptor(Log log) {
private static void loadDescriptorFromClasspath(Log log) {
QuarkusPlatformConfig.defaultConfigBuilder()
.setPlatformDescriptor(newLegacyDescriptor(new MojoMessageWriter(log)))
.setPlatformDescriptor(new QuarkusJsonPlatformDescriptorLoaderBootstrap()
.load(new QuarkusPlatformDescriptorLoaderContext() {
final MessageWriter msgWriter = new MojoMessageWriter(log);
@Override
public MessageWriter getMessageWriter() {
return msgWriter;
}
}))
.build();
}
private static QuarkusLegacyPlatformDescriptor newLegacyDescriptor(final MessageWriter msgWriter) {
return new QuarkusLegacyPlatformDescriptorLoader().load(new QuarkusPlatformDescriptorLoaderContext() {
@Override
public MessageWriter getMessageWriter() {
return msgWriter;
}
});
private static boolean isOnClasspath(Artifact platformArtifact) throws MojoExecutionException {
return "quarkus-bom-descriptor-json".equals(platformArtifact.getArtifactId())
&& "io.quarkus".equals(platformArtifact.getGroupId())
&& (platformArtifact.getVersion() == null
|| platformArtifact.getVersion().isEmpty()
|| platformArtifact.getVersion()
.equals(CreateUtils.resolvePluginInfo(CreateUtils.class).getVersion()));
}
public static Plugin resolvePluginInfo(Class<?> cls) throws MojoExecutionException {
final String pluginClassPath = cls.getName().replace('.', '/') + ".class";
URL url = Thread.currentThread().getContextClassLoader().getResource(pluginClassPath);
if (url == null) {
throw new MojoExecutionException("Failed to locate the origin of " + cls);
}
String classLocation = url.toExternalForm();
if (url.getProtocol().equals("jar")) {
classLocation = classLocation.substring(4, classLocation.length() - pluginClassPath.length() - 2);
try (FileSystem fs = ZipUtils.newFileSystem(toPath(classLocation))) {
return resolvePluginInfo(fs.getPath("META-INF", "maven", "plugin.xml"));
} catch (Exception e) {
throw new MojoExecutionException("Failed to resolve plugin version for " + classLocation, e);
try {
final Path classOrigin = MojoUtils.getClassOrigin(cls);
if (Files.isDirectory(classOrigin)) {
return resolvePluginInfo(classOrigin);
}
} else {
classLocation = classLocation.substring(0, classLocation.length() - pluginClassPath.length());
return resolvePluginInfo(toPath(classLocation));
try (FileSystem fs = ZipUtils.newFileSystem(classOrigin)) {
return resolvePluginInfo(fs.getPath("META-INF", "maven", "plugin.xml"));
}
} catch (Exception e) {
throw new MojoExecutionException("Failed to resolve maven plugin version containing " + cls, e);
}
}
private static Plugin resolvePluginInfo(Path pluginXml) throws MojoExecutionException {
@@ -163,15 +174,6 @@ public final class CreateUtils {
return text;
}
private static Path toPath(String classLocation) throws MojoExecutionException {
try {
return Paths.get(new URL(classLocation).toURI());
} catch (Throwable e) {
throw new MojoExecutionException(
"Failed to create an instance of " + Path.class.getName() + " from " + classLocation, e);
}
}
private static Node getElement(NodeList nodeList, String name) throws MojoExecutionException {
for (int i = 0; i < nodeList.getLength(); ++i) {
final Node item = nodeList.item(i);

View File

@@ -0,0 +1,67 @@
<?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">
<parent>
<artifactId>quarkus-build-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../../build-parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quarkus-platform-descriptor-json-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Quarkus - Dev tools - Platform Descriptor - JSON Maven Plugin</name>
<properties>
<quarkus.version>${project.version}</quarkus.version>
</properties>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-resolver-json</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-creator</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
</dependency>
<!-- extensions reader -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.slf4j</groupId>
<artifactId>slf4j-jboss-logging</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,202 @@
package io.quarkus.maven;
import java.text.MessageFormat;
import java.util.Collections;
import java.util.Map;
import java.util.function.Supplier;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.shared.utils.logging.MessageBuilder;
import org.apache.maven.shared.utils.logging.MessageUtils;
import org.jboss.logging.Logger;
import org.jboss.logging.LoggerProvider;
import org.wildfly.common.Assert;
/**
*/
public class MojoLogger implements LoggerProvider {
static final Object[] NO_PARAMS = new Object[0];
public static volatile Supplier<Log> logSupplier;
@Override
public Logger getLogger(final String name) {
return new Logger(name) {
@Override
protected void doLog(final Level level, final String loggerClassName, final Object message,
final Object[] parameters, final Throwable thrown) {
final Supplier<Log> logSupplier = MojoLogger.logSupplier;
if (logSupplier != null) {
Log log = logSupplier.get();
String text;
if (parameters == null || parameters.length == 0) {
text = String.valueOf(message);
} else {
try {
text = MessageFormat.format(String.valueOf(message), parameters);
} catch (Exception e) {
text = invalidFormat(String.valueOf(message), parameters);
}
}
synchronized (MojoLogger.class) {
doActualLog(log, level, text, thrown);
}
}
}
@Override
protected void doLogf(final Level level, final String loggerClassName, final String format,
final Object[] parameters, final Throwable thrown) {
final Supplier<Log> logSupplier = MojoLogger.logSupplier;
if (logSupplier != null) {
Log log = logSupplier.get();
String text;
if (parameters == null) {
try {
//noinspection RedundantStringFormatCall
text = String.format(format);
} catch (Exception e) {
text = invalidFormat(format, NO_PARAMS);
}
} else {
try {
text = String.format(format, (Object[]) parameters);
} catch (Exception e) {
text = invalidFormat(format, parameters);
}
}
synchronized (MojoLogger.class) {
doActualLog(log, level, text, thrown);
}
}
}
@Override
public boolean isEnabled(final Level level) {
final Supplier<Log> logSupplier = MojoLogger.logSupplier;
if (logSupplier == null)
return false;
Log log = logSupplier.get();
switch (level) {
case FATAL:
case ERROR:
return log.isErrorEnabled();
case WARN:
return log.isWarnEnabled();
case INFO:
return log.isInfoEnabled();
default:
return log.isDebugEnabled();
}
}
void doActualLog(final Log log, final Level level, final String message, final Throwable thrown) {
final MessageBuilder buffer = MessageUtils.buffer();
// style options are limited unless we crack into jansi ourselves
buffer.strong("[").project(name).strong("]").a(" ").a(message);
if (thrown != null) {
switch (level) {
case FATAL:
case ERROR:
log.error(buffer.toString(), thrown);
break;
case WARN:
log.warn(buffer.toString(), thrown);
break;
case INFO:
log.info(buffer.toString(), thrown);
break;
default:
log.debug(buffer.toString(), thrown);
break;
}
} else {
switch (level) {
case FATAL:
case ERROR:
log.error(buffer.toString());
break;
case WARN:
log.warn(buffer.toString());
break;
case INFO:
log.info(buffer.toString());
break;
default:
log.debug(buffer.toString());
break;
}
}
}
};
}
String invalidFormat(final String format, final Object[] parameters) {
final StringBuilder b = new StringBuilder("** invalid format \'" + format + "\'");
if (parameters != null && parameters.length > 0) {
b.append(" [").append(parameters[0]);
for (int i = 1; i < parameters.length; i++) {
b.append(',').append(parameters[i]);
}
b.append("]");
}
return b.toString();
}
@Override
public void clearMdc() {
}
@Override
public Object putMdc(final String key, final Object value) {
//throw Assert.unsupported();
return null;
}
@Override
public Object getMdc(final String key) {
return null;
}
@Override
public void removeMdc(final String key) {
}
@Override
public Map<String, Object> getMdcMap() {
return Collections.emptyMap();
}
@Override
public void clearNdc() {
}
@Override
public String getNdc() {
return "";
}
@Override
public int getNdcDepth() {
return 0;
}
@Override
public String popNdc() {
return "";
}
@Override
public String peekNdc() {
return "";
}
@Override
public void pushNdc(final String message) {
throw Assert.unsupported();
}
@Override
public void setNdcMaxDepth(final int maxDepth) {
}
}

View File

@@ -0,0 +1,175 @@
package io.quarkus.maven;
import java.io.File;
import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.repository.RemoteRepository;
import io.quarkus.bootstrap.BootstrapConstants;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver;
/**
* This goal validates a given JSON descriptor.
* Specifically, it will make sure that all the extensions that are included in the BOM
* the descriptor is referencing that are expected to be in the JSON descriptor are
* actually present in the JSON descriptor. And that all the extensions that are found
* in the JSON descriptor are also present in the BOM the descriptor is referencing.
*
*/
@Mojo(name = "validate-extensions-json")
public class ValidateExtensionsJsonMojo extends AbstractMojo {
@Parameter(property = "jsonGroupId", required = true)
private String jsonGroupId;
@Parameter(property = "jsonArtifactId", required = true)
private String jsonArtifactId;
@Parameter(property = "jsonVersion", required = true)
private String jsonVersion;
@Component
private RepositorySystem repoSystem;
@Parameter(defaultValue = "${repositorySystemSession}", readonly = true)
private RepositorySystemSession repoSession;
@Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true)
private List<RemoteRepository> repos;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
MavenArtifactResolver mvn;
try {
mvn = MavenArtifactResolver.builder()
.setRepositorySystem(repoSystem)
.setRepositorySystemSession(repoSession)
.setRemoteRepositories(repos)
.build();
} catch (AppModelResolverException e) {
throw new MojoExecutionException("Failed to initialize maven artifact resolver", e);
}
final QuarkusPlatformDescriptor descriptor = QuarkusJsonPlatformDescriptorResolver.newInstance()
.setPlatformJsonGroupId(jsonGroupId)
.setPlatformJsonArtifactId(jsonArtifactId)
.setPlatformJsonVersion(jsonVersion)
.setMavenArtifactResolver(mvn)
.resolve();
final DefaultArtifact bomArtifact = new DefaultArtifact(descriptor.getBomGroupId(),
descriptor.getBomArtifactId(), null, "pom", descriptor.getBomVersion());
final Map<String, Artifact> bomExtensions = collectBomExtensions(mvn, bomArtifact);
List<Extension> missingFromBom = Collections.emptyList();
for (Extension ext : descriptor.getExtensions()) {
if (bomExtensions.remove(ext.getGroupId() + ":" + ext.getArtifactId()) == null) {
if (missingFromBom.isEmpty()) {
missingFromBom = new ArrayList<>();
}
missingFromBom.add(ext);
}
}
if (bomExtensions.isEmpty() && missingFromBom.isEmpty()) {
return;
}
if (!bomExtensions.isEmpty()) {
getLog().error("Extensions from " + bomArtifact + " not present in " + jsonGroupId + ":" + jsonArtifactId + ":"
+ jsonVersion);
for (Map.Entry<String, Artifact> entry : bomExtensions.entrySet()) {
getLog().error("- " + entry.getValue());
}
}
if (!missingFromBom.isEmpty()) {
getLog().error("Extensions from " + jsonGroupId + ":" + jsonArtifactId + ":" + jsonVersion + " missing from "
+ bomArtifact);
for (Extension e : missingFromBom) {
getLog().error("- " + e.getGroupId() + ":" + e.getArtifactId() + ":" + e.getClassifier() + ":" + e.getType()
+ ":" + e.getVersion());
}
}
throw new MojoExecutionException("Extensions referenced in " + bomArtifact + " and included in " + jsonGroupId + ":"
+ jsonArtifactId + ":" + jsonVersion + " do not match expectations. See the errors logged above.");
}
private Map<String, Artifact> collectBomExtensions(MavenArtifactResolver mvn, final DefaultArtifact platformBom)
throws MojoExecutionException {
final List<Dependency> bomDeps;
try {
bomDeps = mvn.resolveDescriptor(platformBom).getManagedDependencies();
} catch (AppModelResolverException e) {
throw new MojoExecutionException("Failed to resolve platform BOM " + platformBom, e);
}
final Map<String, Artifact> bomExtensions = new HashMap<>(bomDeps.size());
for (Dependency dep : bomDeps) {
final Artifact artifact = dep.getArtifact();
if (!artifact.getExtension().equals("jar")
|| "javadoc".equals(artifact.getClassifier())
|| "tests".equals(artifact.getClassifier())
|| "sources".equals(artifact.getClassifier())) {
continue;
}
try {
analyzeArtifact(mvn.resolve(artifact).getArtifact(), bomExtensions);
} catch (AppModelResolverException e) {
getLog().warn("Failed to resolve " + artifact + " from managed dependencies of BOM " + platformBom);
}
}
return bomExtensions;
}
private void analyzeArtifact(Artifact artifact, Map<String, Artifact> extensions) throws MojoExecutionException {
final File file = artifact.getFile();
if (!file.exists()) {
throw new MojoExecutionException("Failed to locate " + artifact + " at " + file);
}
if (file.isDirectory()) {
processExtensionDescriptor(artifact, file.toPath().resolve(BootstrapConstants.META_INF)
.resolve(BootstrapConstants.EXTENSION_PROPS_JSON_FILE_NAME), extensions);
} else {
try (FileSystem fs = FileSystems.newFileSystem(file.toPath(), null)) {
processExtensionDescriptor(artifact,
fs.getPath("/", BootstrapConstants.META_INF, BootstrapConstants.EXTENSION_PROPS_JSON_FILE_NAME),
extensions);
} catch (IOException e) {
throw new MojoExecutionException("Failed to read " + file, e);
}
}
}
private void processExtensionDescriptor(Artifact artifact, Path p, Map<String, Artifact> extensions) {
if (Files.exists(p)) {
extensions.put(artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact);
}
}
}

View File

@@ -14,6 +14,31 @@
<name>Quarkus - Dev tools - Platform Descriptor - JSON</name>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/filtered</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/../../bom/runtime</directory>
<targetPath>quarkus-bom</targetPath>
<filtering>true</filtering>
<includes>
<include>pom.xml</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}/../bom-descriptor-json/target</directory>
<targetPath>quarkus-bom-descriptor</targetPath>
<filtering>false</filtering>
<includes>
<include>extensions.json</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
@@ -23,11 +48,13 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-templates</artifactId>
<artifactId>quarkus-bootstrap-core</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
<artifactId>quarkus-bom-descriptor-json</artifactId>
<version>${project.version}</version>
<type>json</type>
</dependency>
<!-- extensions reader -->
<dependency>

View File

@@ -4,6 +4,7 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
@@ -100,23 +101,31 @@ public class QuarkusJsonPlatformDescriptor implements QuarkusPlatformDescriptor
if (templatesJar == null) {
return null;
}
try (FileSystem fs = ZipUtils.newFileSystem(templatesJar)) {
final Path p = fs.getPath(name);
if (!Files.exists(p)) {
throw new RuntimeException("Failed to locate template " + name + " in " + templatesJar);
try {
if (Files.isDirectory(templatesJar)) {
return readTemplate(name, templatesJar.resolve(name));
}
try (BufferedReader reader = Files.newBufferedReader(p)) {
return reader.lines().collect(Collectors.joining("\n"));
try (FileSystem fs = ZipUtils.newFileSystem(templatesJar)) {
return readTemplate(name, fs.getPath(name));
}
} catch (IOException e) {
throw new RuntimeException("Failed to resolve template " + name, e);
}
}
private String readTemplate(String name, final Path p) throws IOException {
if (!Files.exists(p)) {
throw new RuntimeException("Failed to locate template " + name + " in " + templatesJar);
}
try (BufferedReader reader = Files.newBufferedReader(p)) {
return reader.lines().collect(Collectors.joining("\n"));
}
}
@Override
public <T> T loadResource(String name, ResourceInputStreamConsumer<T> consumer) throws IOException {
getLog().debug("Loading Quarkus platform resource %s", name);
try (FileSystem fs = ZipUtils.newFileSystem(templatesJar)) {
try (FileSystem fs = FileSystems.newFileSystem(templatesJar, null)) {
final Path p = fs.getPath(name);
if (!Files.exists(p)) {
throw new IOException("Failed to locate resource " + name);

View File

@@ -0,0 +1,119 @@
package io.quarkus.platform.descriptor.loader.json.impl;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Properties;
import java.util.function.Function;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import io.quarkus.maven.utilities.MojoUtils;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
import io.quarkus.platform.descriptor.loader.json.ArtifactResolver;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoaderContext;
import io.quarkus.platform.tools.MessageWriter;
public class QuarkusJsonPlatformDescriptorLoaderBootstrap
implements QuarkusPlatformDescriptorLoader<QuarkusPlatformDescriptor, QuarkusPlatformDescriptorLoaderContext> {
private static InputStream getResourceStream(String relativePath) {
final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(relativePath);
if (is == null) {
throw new IllegalStateException("Failed to locate " + relativePath + " on the classpath");
}
return is;
}
@Override
public QuarkusPlatformDescriptor load(QuarkusPlatformDescriptorLoaderContext context) {
context.getMessageWriter().debug("Loading the default Quarkus Platform descriptor from the classpath");
final Properties props = new Properties();
final InputStream quarkusProps = getResourceStream("quarkus.properties");
try {
props.load(quarkusProps);
} catch (IOException e) {
throw new IllegalStateException("Failed to load properties quarkus.properties", e);
}
final ArtifactResolver resolver = new ArtifactResolver() {
@Override
public <T> T process(String groupId, String artifactId, String classifier, String type, String version,
Function<Path, T> processor) {
throw new UnsupportedOperationException();
}
@Override
public List<Dependency> getManagedDependencies(String groupId, String artifactId, String version) {
if (artifactId.equals("quarkus-bom")
&& version.equals(props.get("plugin-version"))
&& groupId.equals("io.quarkus")) {
try {
final Model model = MojoUtils.readPom(getResourceStream("quarkus-bom/pom.xml"));
final List<Dependency> deps = model.getDependencyManagement().getDependencies();
for (Dependency d : deps) {
if (d.getVersion().startsWith("${")) {
d.setVersion(model.getProperties()
.getProperty(d.getVersion().substring(2, d.getVersion().length() - 1)));
}
}
return deps;
} catch (IOException e) {
throw new IllegalStateException(
"Failed to load POM model from " + groupId + ":" + artifactId + ":" + version, e);
}
}
throw new IllegalStateException("Unexpected artifact " + groupId + ":" + artifactId + ":" + version);
}
};
final Path resourceRoot;
try {
resourceRoot = MojoUtils.getClassOrigin(QuarkusJsonPlatformDescriptorLoaderBootstrap.class);
} catch (IOException e) {
throw new IllegalStateException("Failed to determine the resource root for " + getClass().getName(), e);
}
return new QuarkusJsonPlatformDescriptorLoaderImpl().load(new QuarkusJsonPlatformDescriptorLoaderContext() {
@Override
public MessageWriter getMessageWriter() {
return context.getMessageWriter();
}
@Override
public <T> T parseJson(Function<Path, T> parser) {
if (Files.isDirectory(resourceRoot)) {
return doParse(resourceRoot.resolve("quarkus-bom-descriptor/extensions.json"), parser);
}
try (FileSystem fs = FileSystems.newFileSystem(resourceRoot, null)) {
return doParse(fs.getPath("/quarkus-bom-descriptor/extensions.json"), parser);
} catch (IOException e) {
throw new IllegalStateException("Failed to open " + resourceRoot, e);
}
}
@Override
public ArtifactResolver getArtifactResolver() {
return resolver;
}
});
}
private static <T> T doParse(Path p, Function<Path, T> parser) {
if (!Files.exists(p)) {
throw new IllegalStateException("Path does not exist: " + p);
}
return parser.apply(p);
}
}

View File

@@ -3,19 +3,16 @@ package io.quarkus.platform.descriptor.loader.json.impl;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.aether.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.graph.Dependency;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.maven.utilities.MojoUtils;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoaderContext;
@@ -23,70 +20,67 @@ public class QuarkusJsonPlatformDescriptorLoaderImpl
implements QuarkusJsonPlatformDescriptorLoader<QuarkusJsonPlatformDescriptor> {
private static final String IO_QUARKUS = "io.quarkus";
private static final String TEMPLATES_ARTIFACT_ID = "quarkus-devtools-templates";
private static final String QUARKUS_CORE_ARTIFACT_ID = "quarkus-core";
@Override
public QuarkusJsonPlatformDescriptor load(QuarkusJsonPlatformDescriptorLoaderContext context) {
context.getMessageWriter().debug("Loading Platform Descriptor from JSON %s", context.getJsonDescriptorFile());
final QuarkusJsonPlatformDescriptor platform;
try {
ObjectMapper mapper = new ObjectMapper()
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.enable(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS);
try (InputStream is = Files.newInputStream(context.getJsonDescriptorFile())) {
platform = mapper.readValue(is, QuarkusJsonPlatformDescriptor.class);
}
} catch (IOException e) {
throw new RuntimeException("Unable to load " + context.getJsonDescriptorFile(), e);
}
public QuarkusJsonPlatformDescriptor load(final QuarkusJsonPlatformDescriptorLoaderContext context) {
final QuarkusJsonPlatformDescriptor platform = context
.parseJson(p -> {
context.getMessageWriter().debug("Loading Platform Descriptor from JSON %s", p);
try {
ObjectMapper mapper = new ObjectMapper()
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.enable(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS);
try (InputStream is = Files.newInputStream(p)) {
return mapper.readValue(is, QuarkusJsonPlatformDescriptor.class);
}
} catch (IOException e) {
throw new RuntimeException("Unable to load " + p, e);
}
});
final DefaultArtifact platformBom = new DefaultArtifact(platform.getBomGroupId(), platform.getBomArtifactId(), null,
"pom", platform.getBomVersion());
String quarkusVersion = null;
try {
final List<Dependency> managedDeps = context.getMavenArtifactResolver().resolveDescriptor(platformBom)
.getManagedDependencies();
final List<org.apache.maven.model.Dependency> convertedDeps = new ArrayList<>(managedDeps.size());
final List<Dependency> managedDeps = context.getArtifactResolver().getManagedDependencies(platformBom.getGroupId(),
platformBom.getArtifactId(), platformBom.getVersion());
final List<Dependency> convertedDeps = new ArrayList<>(managedDeps.size());
for (Dependency dep : managedDeps) {
final org.apache.maven.model.Dependency converted = new org.apache.maven.model.Dependency();
convertedDeps.add(converted);
final Artifact artifact = dep.getArtifact();
converted.setGroupId(artifact.getGroupId());
converted.setArtifactId(artifact.getArtifactId());
converted.setVersion(artifact.getVersion());
converted.setClassifier(artifact.getClassifier());
converted.setType(artifact.getExtension());
converted.setGroupId(dep.getGroupId());
converted.setArtifactId(dep.getArtifactId());
converted.setVersion(dep.getVersion());
converted.setClassifier(dep.getClassifier());
converted.setType(dep.getType());
converted.setScope(dep.getScope());
converted.setOptional(dep.isOptional());
// exclusions aren't added yet
if (artifact.getArtifactId().equals(QUARKUS_CORE_ARTIFACT_ID)
&& artifact.getGroupId().equals(IO_QUARKUS)) {
quarkusVersion = artifact.getVersion();
if (dep.getArtifactId().equals(QUARKUS_CORE_ARTIFACT_ID)
&& dep.getGroupId().equals(IO_QUARKUS)) {
quarkusVersion = dep.getVersion();
}
}
platform.setManagedDependencies(convertedDeps);
} catch (AppModelResolverException e) {
} catch (Exception e) {
throw new RuntimeException("Failed to read descriptor of " + platformBom, e);
}
if (quarkusVersion == null) {
throw new RuntimeException("Failed to determine the Quarkus version for the platform " + platformBom);
}
platform.setTemplatesJar(resolveArtifact(context.getMavenArtifactResolver(),
new DefaultArtifact(IO_QUARKUS, TEMPLATES_ARTIFACT_ID, null, "jar", quarkusVersion)));
try {
platform.setTemplatesJar(MojoUtils.getClassOrigin(getClass()));
} catch (Exception e) {
throw new IllegalStateException("Failed to determine the origin of " + getClass().getName(), e);
}
platform.setQuarkusVersion(quarkusVersion);
platform.setMessageWriter(context.getMessageWriter());
return platform;
}
private static Path resolveArtifact(MavenArtifactResolver mvn, Artifact artifact) {
try {
return mvn.resolve(artifact).getArtifact().getFile().toPath();
} catch (AppModelResolverException e) {
throw new RuntimeException("Failed to resolve " + artifact, e);
}
}
}

View File

@@ -1,11 +1,14 @@
package io.quarkus.platform.descriptor.loader.json.util;
import java.nio.file.Path;
import java.util.function.Function;
import org.eclipse.aether.artifact.Artifact;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.maven.utilities.MojoUtils;
import io.quarkus.platform.descriptor.loader.json.ArtifactResolver;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoaderContext;
import io.quarkus.platform.descriptor.loader.json.impl.QuarkusJsonPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.json.impl.QuarkusJsonPlatformDescriptorLoaderImpl;
@@ -28,6 +31,7 @@ public class QuarkusJsonDescriptorUtils {
final Path platformJson = jsonArtifact.getFile().toPath();
log.debug("Quarkus platform JSON descriptor %s", jsonArtifact);
final ArtifactResolver resolver = MojoUtils.toJsonArtifactResolver(mvn);
return new QuarkusJsonPlatformDescriptorLoaderImpl()
.load(new QuarkusJsonPlatformDescriptorLoaderContext() {
@@ -37,13 +41,13 @@ public class QuarkusJsonDescriptorUtils {
}
@Override
public Path getJsonDescriptorFile() {
return platformJson;
public <T> T parseJson(Function<Path, T> parser) {
return parser.apply(platformJson);
}
@Override
public MavenArtifactResolver getMavenArtifactResolver() {
return mvn;
public ArtifactResolver getArtifactResolver() {
return resolver;
}
});
}

View File

@@ -0,0 +1 @@
io.quarkus.platform.descriptor.loader.json.impl.QuarkusJsonPlatformDescriptorLoaderBootstrap

View File

@@ -1,55 +0,0 @@
<?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>io.quarkus</groupId>
<artifactId>quarkus-devtools-all</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<name>Quarkus - Dev tools - Platform Descriptor - Legacy</name>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/filtered</directory>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/../../bom/runtime</directory>
<targetPath>quarkus-bom</targetPath>
<filtering>false</filtering>
<includes>
<include>pom.xml</include>
</includes>
</resource>
</resources>
</build>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-api</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-templates</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
</dependency>
<!-- extensions reader -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,849 +0,0 @@
[
{
"name": "Agroal - Database connection pool",
"labels": [
"agroal",
"database-connection-pool"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-agroal",
"version": "${project.version}"
},
{
"name": "Amazon DynamoDB",
"labels": [
"dynamodb",
"dynamo",
"aws",
"amazon"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-amazon-dynamodb",
"version": "${project.version}"
},
{
"name": "Apache Kafka Client",
"labels": [
"kafka"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kafka-client",
"version": "${project.version}"
},
{
"name": "Apache Kafka Streams",
"labels": [
"kafka",
"kafka-streams"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kafka-streams",
"version": "${project.version}"
},
{
"name": "Apache Tika",
"labels": [
"tika",
"parser"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-tika",
"version": "${project.version}"
},
{
"name": "Arc",
"shortName": "CDI",
"labels": [
"arc",
"cdi",
"dependency-injection",
"di"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-arc",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/cdi-reference"
},
{
"name": "AWS Lambda",
"labels": [
"lambda",
"aws",
"amazon"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-amazon-lambda",
"version": "${project.version}"
},
{
"name": "Artemis Core",
"labels": [
"artemis-core",
"artemis"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-artemis-core",
"version": "${project.version}"
},
{
"name": "Artemis JMS",
"labels": [
"artemis-jms",
"artemis"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-artemis-jms",
"version": "${project.version}"
},
{
"name": "Flyway",
"labels": [
"flyway",
"database",
"data"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-flyway",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/flyway-guide"
},
{
"name": "Hibernate ORM",
"shortName": "JPA",
"labels": [
"hibernate-orm",
"jpa",
"hibernate"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-hibernate-orm",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/hibernate-orm-guide"
},
{
"name": "Hibernate ORM with Panache",
"labels": [
"hibernate-orm-panache",
"panache",
"hibernate",
"jpa"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-hibernate-orm-panache",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/hibernate-orm-panache-guide"
},
{
"name": "Hibernate Search + Elasticsearch",
"labels": [
"hibernate-search-elasticsearch",
"search",
"full-text",
"hibernate",
"elasticsearch"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-hibernate-search-elasticsearch",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/hibernate-search-guide"
},
{
"name": "Hibernate Validator",
"shortName": "bean validation",
"labels": [
"hibernate-validator",
"bean-validation",
"validation"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-hibernate-validator",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/validation-guide"
},
{
"name": "Infinispan Client",
"labels": [
"infinispan-client",
"data-grid-client",
"infinispan"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-infinispan-client",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/infinispan-client-guide"
},
{
"name": "JDBC Driver - Derby",
"labels": [
"jdbc-derby",
"jdbc",
"derby"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-derby"
},
{
"name": "JDBC Driver - H2",
"labels": [
"jdbc-h2",
"jdbc",
"h2"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-h2",
"version": "${project.version}"
},
{
"name": "JDBC Driver - MariaDB",
"labels": [
"jdbc-mariadb",
"jdbc",
"mariadb"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-mariadb",
"version": "${project.version}"
},
{
"name": "JDBC Driver - MySQL",
"labels": [
"jdbc-mysql",
"jdbc",
"mysql"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-mysql",
"version": "${project.version}"
},
{
"name": "JDBC Driver - PostgreSQL",
"labels": [
"jdbc-postgresql",
"jdbc",
"postgresql"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-postgresql",
"version": "${project.version}"
},
{
"name": "JDBC Driver - Microsoft SQL Server",
"labels": [
"jdbc-mssql",
"jdbc",
"mssql",
"sql-server"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jdbc-mssql",
"version": "${project.version}"
},
{
"name": "Jackson",
"labels": [
"jackson",
"json"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jackson",
"version": "${project.version}"
},
{
"name": "JAXB",
"labels": [
"jaxb"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jaxb",
"version": "${project.version}"
},
{
"name": "JGit",
"labels": [
"git"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jgit",
"version": "${project.version}"
},
{
"name": "JSON-B",
"labels": [
"jsonb",
"json-b",
"json"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jsonb",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/rest-json-guide"
},
{
"name": "JSON-P",
"labels": [
"jsonp",
"json-p",
"json"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-jsonp",
"version": "${project.version}"
},
{
"name": "OpenID Connect",
"labels": [
"oauth2",
"openid-connect"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-oidc",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/oidc-guide"
},
{
"name": "Keycloak Authorization",
"labels": [
"oauth2",
"openid-connect",
"keycloak",
"authorization-services",
"policy-enforcer",
"fine-grained-permission",
"resource-based-authorization"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-keycloak-authorization",
"guide": "https://quarkus.io/guides/keycloak-authorization-guide"
},
{
"name": "Kogito",
"labels": [
"kogito",
"drools",
"jbpm"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kogito",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/kogito-guide"
},
{
"name": "Kotlin",
"labels": [
"kotlin"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kotlin",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/kotlin"
},
{
"name": "Kubernetes",
"labels": [
"kubernetes"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kubernetes",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/kubernetes-guide"
},
{
"name": "Kubernetes Client",
"labels": [
"kubernetes-client"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-kubernetes-client",
"version": "${project.version}"
},
{
"name": "Mailer",
"labels": [
"mail",
"mailer"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-mailer",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/sending-emails"
},
{
"name": "MongoDB Client",
"labels": [
"mongo",
"mongodb",
"nosql",
"datastore"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-mongodb-client",
"version": "${project.version}"
},
{
"name": "MongoDB with Panache",
"labels": [
"mongo",
"mongodb",
"nosql",
"datastore",
"panache"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-mongodb-panache",
"version": "${project.version}"
},
{
"name": "Narayana JTA - Transaction manager",
"labels": [
"narayana-jta",
"narayana",
"jta",
"transactions",
"transaction",
"tx",
"txs"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-narayana-jta",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/transaction-guide"
},
{
"name": "Narayana STM - Software Transactional Memory",
"labels": [
"narayana-stm",
"narayana",
"stm",
"transactions",
"transaction",
"software-transactional-memory",
"tx",
"txs"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-narayana-stm",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/stm-guide"
},
{
"name": "Neo4j client",
"labels": [
"neo4j",
"graph",
"nosql",
"datastore"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-neo4j",
"version": "${project.version}"
},
{
"name": "Reactive PostgreSQL Client",
"labels": [
"eclipse-vert.x",
"vertx",
"vert.x",
"reactive",
"database",
"data",
"postgresql"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-reactive-pg-client",
"version": "${project.version}"
},
{
"name": "Reactive MySQL Client",
"labels": [
"eclipse-vert.x",
"vertx",
"vert.x",
"reactive",
"database",
"data",
"mysql"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-reactive-mysql-client",
"version": "${project.version}"
},
{
"name": "RESTEasy",
"shortName": "jax-rs",
"labels": [
"resteasy",
"jaxrs",
"web",
"rest"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-resteasy",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/rest-json-guide"
},
{
"name": "RESTEasy - JAXB",
"labels": [
"resteasy-jaxb",
"jaxrs-jaxb",
"resteasy",
"jaxb"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-resteasy-jaxb",
"version": "${project.version}"
},
{
"name": "RESTEasy - Jackson",
"labels": [
"resteasy-jackson",
"jaxrs-json",
"resteasy-json",
"resteasy",
"jaxrs",
"json",
"jackson"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-resteasy-jackson",
"version": "${project.version}"
},
{
"name": "RESTEasy - JSON-B",
"labels": [
"resteasy-jsonb",
"jaxrs-json",
"resteasy-json",
"resteasy",
"jaxrs",
"json",
"jsonb"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-resteasy-jsonb",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/rest-json-guide"
},
{
"name": "Scala",
"labels": [
"scala"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-scala",
"version": "${project.version}"
},
{
"name": "Scheduler",
"labels": [
"scheduler",
"tasks",
"periodic-tasks"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-scheduler",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/scheduled-guide"
},
{
"name": "Properties File based Security",
"labels": [
"security"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-elytron-security-properties-file",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/elytron-properties-guide"
},
{
"name": "JDBC based Security",
"labels": [
"security",
"jdbc"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-elytron-security-jdbc",
"version": "${project.version}"
},
{
"name": "Security OAuth2",
"labels": [
"security",
"oauth2"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-elytron-security-oauth2",
"version": "${project.version}"
},
{
"name": "SmallRye Context Propagation",
"shortName": "context propagation",
"labels": [
"smallrye-context-propagation",
"microprofile-context-propagation",
"context-propagation",
"context",
"reactive"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-context-propagation",
"version": "${project.version}"
},
{
"name": "SmallRye Fault Tolerance",
"labels": [
"smallrye-fault-tolerance",
"fault-tolerance",
"microprofile-fault-tolerance",
"circuit-breaker",
"bulkhead"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-fault-tolerance",
"version": "${project.version}"
},
{
"name": "SmallRye Health",
"shortName": "health",
"labels": [
"smallrye-health",
"health-check",
"health",
"microprofile-health",
"microprofile-health-check"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-health",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/health-guide"
},
{
"name": "SmallRye JWT",
"labels": [
"smallrye-jwt",
"jwt",
"json-web-token",
"rbac"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-jwt",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/jwt-guide"
},
{
"name": "SmallRye Metrics",
"shortName": "metrics",
"labels": [
"smallrye-metrics",
"metrics",
"metric",
"prometheus",
"monitoring"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-metrics",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/metrics-guide"
},
{
"name": "SmallRye OpenAPI",
"labels": [
"smallrye-openapi",
"openapi",
"open-api"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-openapi",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/openapi-swaggerui-guide"
},
{
"name": "SmallRye OpenTracing",
"labels": [
"smallrye-opentracing",
"opentracing",
"tracing",
"distributed-tracing",
"jaeger"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-opentracing",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/opentracing-guide"
},
{
"name": "SmallRye Reactive Streams Operators",
"shortName": "reactive streams",
"labels": [
"smallrye-reactive-streams-operators",
"smallrye-reactive-streams",
"reactive-streams-operators",
"reactive-streams",
"microprofile-reactive-streams",
"reactive"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-streams-operators",
"version": "${project.version}"
},
{
"name": "SmallRye Reactive Type Converters",
"labels": [
"smallrye-reactive-type-converters",
"reactive-type-converters",
"reactive-streams-operators",
"reactive-streams",
"microprofile-reactive-streams",
"reactive"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-type-converters",
"version": "${project.version}"
},
{
"name": "SmallRye Reactive Messaging",
"labels": [
"smallrye-reactive-messaging",
"reactive-messaging",
"reactive"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-messaging",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/async-message-passing"
},
{
"name": "SmallRye Reactive Messaging - Kafka Connector",
"shortName": "kafka",
"labels": [
"kafka",
"reactive-kafka"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-messaging-kafka",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/kafka-guide"
},
{
"name": "SmallRye Reactive Messaging - AMQP Connector",
"labels": [
"amqp",
"reactive-amqp"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-messaging-amqp",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/amqp-guide"
},
{
"name": "SmallRye Reactive Messaging - MQTT Connector",
"labels": [
"mqtt",
"reactive-mqtt"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-smallrye-reactive-messaging-mqtt",
"version": "${project.version}"
},
{
"name": "REST Client",
"labels": [
"rest-client",
"web-client",
"microprofile-rest-client"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-rest-client",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/rest-client-guide"
},
{
"name": "Quarkus Extension for Spring DI API",
"labels": [
"spring-di"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-spring-di",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/spring-di-guide"
},
{
"name": "Quarkus Extension for Spring Web API",
"labels": [
"spring-web"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-spring-web",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/spring-web-guide"
},
{
"name": "Quarkus Extension for Spring Data API",
"labels": [
"spring-data"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-spring-data-jpa",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/spring-data-jpa-guide"
},
{
"name": "Swagger UI",
"labels": [
"swagger-ui"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-swagger-ui",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/openapi-swaggerui-guide"
},
{
"name": "Undertow",
"shortName": "servlet",
"labels": [
"undertow",
"servlet"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-undertow",
"version": "${project.version}"
},
{
"name": "Undertow WebSockets",
"shortName": "websockets",
"labels": [
"undertow-websockets",
"undertow-websocket",
"websocket",
"websockets",
"web-socket",
"web-sockets"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-undertow-websockets",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/websocket-guide"
},
{
"name": "Vault",
"labels": [
"vault",
"security"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-vault"
},
{
"name": "Eclipse Vert.x",
"labels": [
"eclipse-vert.x",
"vertx",
"vert.x",
"reactive"
],
"groupId": "io.quarkus",
"artifactId": "quarkus-vertx",
"version": "${project.version}",
"guide": "https://quarkus.io/guides/using-vertx"
}
]

View File

@@ -1,166 +0,0 @@
package io.quarkus.platform.descriptor.loader.legacy;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.ResourceInputStreamConsumer;
import io.quarkus.platform.tools.MessageWriter;
public class QuarkusLegacyPlatformDescriptor implements QuarkusPlatformDescriptor {
private final ClassLoader cl;
private final String groupId;
private final String artifactId;
private final String version;
private final List<Extension> extensions;
private final List<Dependency> managedDeps;
private final MessageWriter log;
public QuarkusLegacyPlatformDescriptor(ClassLoader cl, MessageWriter log) {
this.cl = cl;
this.log = log;
// Resolve the BOM model
InputStream is = cl.getResourceAsStream("quarkus-bom/pom.xml");
if (is == null) {
throw new RuntimeException("Failed to locate quarkus-bom/pom.xml");
}
final Model bomModel;
try {
bomModel = new MavenXpp3Reader().read(is);
} catch (Exception e) {
throw new RuntimeException("Failed to parse application POM model", e);
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
groupId = resolveGroupId(bomModel);
artifactId = bomModel.getArtifactId();
version = resolveVersion(bomModel);
managedDeps = bomModel.getDependencyManagement().getDependencies(); // This is raw but that's exactly how it used to be
// Load extensions
is = cl.getResourceAsStream("extensions.json");
if (is == null) {
throw new RuntimeException("Failed to locate quarkus-bom/pom.xml");
}
ObjectMapper mapper = new ObjectMapper()
.enable(JsonParser.Feature.ALLOW_COMMENTS)
.enable(JsonParser.Feature.ALLOW_NUMERIC_LEADING_ZEROS);
try {
extensions = mapper.readValue(
is,
new TypeReference<List<Extension>>() {
// Do nothing.
});
} catch (Exception e) {
throw new RuntimeException("Failed parse extensions.json", e);
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
@Override
public String getBomGroupId() {
return groupId;
}
@Override
public String getBomArtifactId() {
return artifactId;
}
@Override
public String getBomVersion() {
return version;
}
@Override
public String getQuarkusVersion() {
return version;
}
@Override
public List<Dependency> getManagedDependencies() {
return managedDeps;
}
@Override
public List<Extension> getExtensions() {
return extensions;
}
@Override
public String getTemplate(String name) {
log.debug("[Legacy Quarkus Platform Descriptor] Loading Quarkus project template %s", name);
InputStream is = cl.getResourceAsStream(name);
if (is == null) {
throw new RuntimeException("Failed to locate template " + name);
}
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
return reader.lines().collect(Collectors.joining("\n"));
} catch (IOException e) {
throw new RuntimeException("Failed to read template " + name, e);
}
}
@Override
public <T> T loadResource(String name, ResourceInputStreamConsumer<T> consumer) throws IOException {
log.debug("[Legacy Quarkus Platform Descriptor] Loading Quarkus platform resource %s", name);
InputStream is = cl.getResourceAsStream(name);
if (is == null) {
throw new IOException("Failed to locate resource " + name);
}
try {
return consumer.handle(is);
} finally {
is.close();
}
}
private static String resolveGroupId(Model model) {
String groupId = model.getGroupId();
if (groupId != null) {
return groupId;
}
groupId = model.getParent() == null ? null : model.getParent().getGroupId();
if (groupId == null) {
throw new IllegalStateException("Failed to resolve groupId for the platform BOM");
}
return groupId;
}
private static String resolveVersion(Model model) {
String version = model.getVersion();
if (version != null) {
return version;
}
version = model.getParent() == null ? null : model.getParent().getVersion();
if (version == null) {
throw new IllegalStateException("Failed to resolve version for the platform BOM");
}
return version;
}
}

View File

@@ -1,14 +0,0 @@
package io.quarkus.platform.descriptor.loader.legacy;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
public class QuarkusLegacyPlatformDescriptorLoader
implements QuarkusPlatformDescriptorLoader<QuarkusLegacyPlatformDescriptor, QuarkusPlatformDescriptorLoaderContext> {
@Override
public QuarkusLegacyPlatformDescriptor load(QuarkusPlatformDescriptorLoaderContext context) {
context.getMessageWriter().debug("Loading legacy Quarkus Core Platform descriptor");
return new QuarkusLegacyPlatformDescriptor(Thread.currentThread().getContextClassLoader(), context.getMessageWriter());
}
}

View File

@@ -1 +0,0 @@
io.quarkus.platform.descriptor.loader.legacy.QuarkusLegacyPlatformDescriptorLoader

View File

@@ -20,13 +20,12 @@
</properties>
<modules>
<module>platform-descriptor-json-plugin</module>
<module>bom-descriptor-json</module>
<module>platform-descriptor-json</module>
<module>platform-descriptor-legacy</module>
<module>maven</module>
<module>gradle</module>
<module>aesh</module>
<module>reflection-agent</module>
<module>templates</module>
</modules>
</project>

View File

@@ -1,28 +0,0 @@
<?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>io.quarkus</groupId>
<artifactId>quarkus-devtools-all</artifactId>
<version>999-SNAPSHOT</version>
</parent>
<artifactId>quarkus-devtools-templates</artifactId>
<name>Quarkus - Dev tools - Templates</name>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/filtered</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@@ -186,6 +186,9 @@ Similar to the Maven configuration, when using Gradle, the following modificatio
[source,groovy,subs=attributes+]
----
group = '...' // set your group
version = '1.0.0-SNAPSHOT'
plugins {
id 'java'
id 'io.quarkus' version '{quarkus-version}' // <1>
@@ -198,9 +201,6 @@ repositories {
mavenCentral()
}
group = '...' // set your group
version = '1.0.0-SNAPSHOT'
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:{kotlin-version}'
@@ -211,7 +211,7 @@ dependencies {
implementation 'io.quarkus:quarkus-kotlin'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
testImplementation 'io.rest-assured:rest-assured:{rest-assured-version}' // <4>
}
sourceCompatibility = '1.8'
@@ -226,7 +226,7 @@ buildNative {
enableHttpUrlHandler = true
}
allOpen { // <4>
allOpen { // <5>
annotation("javax.ws.rs.Path")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("io.quarkus.test.junit.QuarkusTest")
@@ -236,7 +236,8 @@ allOpen { // <4>
<1> The Quarkus plugin needs to be applied.
<2> The Kotlin plugin version needs to be specified.
<3> We include the Quarkus BOM using Gradle's link:https://docs.gradle.org/5.4.1/userguide/managing_transitive_dependencies.html#sec:bom_import[relevant syntax]
<4> The all-open configuration required, as per Maven guide above
<4> The rest-assured version needs to be specified
<5> The all-open configuration required, as per Maven guide above
or, if you use the Gradle Kotlin DSL:
@@ -270,7 +271,7 @@ dependencies {
implementation("io.quarkus:quarkus-resteasy-jsonb")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
testImplementation("io.rest-assured:rest-assured:{rest-assured-version}") // <4>
}
tasks {
@@ -279,7 +280,7 @@ tasks {
}
}
allOpen { // <4>
allOpen { // <5>
annotation("javax.ws.rs.Path")
annotation("javax.enterprise.context.ApplicationScoped")
annotation("io.quarkus.test.junit.QuarkusTest")
@@ -304,7 +305,8 @@ compileTestKotlin.kotlinOptions {
<1> The Quarkus plugin needs to be applied.
<2> The Kotlin plugin version needs to be specified.
<3> We include the Quarkus BOM using Gradle's link:https://docs.gradle.org/5.4.1/userguide/managing_transitive_dependencies.html#sec:bom_import[relevant syntax]
<4> The all-open configuration required, as per Maven guide above
<4> The rest-assured version needs to be specified
<5> The all-open configuration required, as per Maven guide above
== CDI @Inject with Kotlin

View File

@@ -128,6 +128,10 @@
<module>vault</module>
</modules>
<!-- Unfortunately the config below introduces a build dependency on the maven plugin
which leads to an ordering that prevents the tooling to include the generated
JSON platform descriptor.
Hopefully, this can be re-enabled once we refactor the tools.
<build>
<plugins>
<plugin>
@@ -135,9 +139,9 @@
<artifactId>quarkus-maven-plugin</artifactId>
<version>${project.version}</version>
<inherited>false</inherited>
<!-- Settings for stubbing new extensions via
< ! - - Settings for stubbing new extensions via
mvn quarkus:create-extension -N -Dquarkus.artifactIdBase=my-ext -Dquarkus.nameBase="My Extension"
-->
- - >
<configuration>
<artifactIdPrefix>quarkus-</artifactIdPrefix>
<namePrefix xml:space="preserve">Quarkus - </namePrefix>
@@ -149,5 +153,5 @@
</plugin>
</plugins>
</build>
-->
</project>

View File

@@ -38,7 +38,7 @@
<version.cdi>2.0.SP1</version.cdi>
<version.jandex>2.1.1.Final</version.jandex>
<version.junit5>5.5.2</version.junit5>
<version.maven>3.5.2</version.maven>
<version.maven>3.5.4</version.maven>
<version.assertj>3.12.2</version.assertj>
<version.jboss-logging>3.3.2.Final</version.jboss-logging>
<version.javax-annotation>1.3.2</version.javax-annotation>

View File

@@ -13,6 +13,18 @@
<artifactId>quarkus-devtools-common</artifactId>
<name>Quarkus - Dev tools - Common</name>
<build>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/filtered</directory>
<filtering>true</filtering>
</testResource>
</testResources>
</build>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
@@ -50,16 +62,6 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-templates</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<scope>test</scope>
</dependency>
<!-- extensions reader -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>

View File

@@ -7,8 +7,12 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.function.Function;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
@@ -19,9 +23,14 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.json.ArtifactResolver;
import io.quarkus.platform.tools.config.QuarkusPlatformConfig;
/**
@@ -81,6 +90,10 @@ public class MojoUtils {
return get("plugin-groupId");
}
public static String getPluginKey() {
return MojoUtils.getPluginGroupId() + ":" + MojoUtils.getPluginArtifactId();
}
public static String getPluginVersion() {
return getPlatformDescriptor().getQuarkusVersion();
}
@@ -126,27 +139,6 @@ public class MojoUtils {
return getProperties().getProperty(key);
}
/**
* Checks whether or not the given project has a plugin with the given key. The key is given using the
* "groupId:artifactId" syntax.
*
* @param project the project
* @param pluginKey the plugin
* @return an Optional completed if the plugin is found.
*/
public static Optional<Plugin> hasPlugin(MavenProject project, String pluginKey) {
Optional<Plugin> optPlugin = project.getBuildPlugins().stream()
.filter(plugin -> pluginKey.equals(plugin.getKey()))
.findFirst();
if (!optPlugin.isPresent() && project.getPluginManagement() != null) {
optPlugin = project.getPluginManagement().getPlugins().stream()
.filter(plugin -> pluginKey.equals(plugin.getKey()))
.findFirst();
}
return optPlugin;
}
/**
* Checks whether the project has the dependency
*
@@ -373,4 +365,72 @@ public class MojoUtils {
return gavOut;
}
/**
* Returns the JAR or the root directory that contains the class file that is on the
* classpath of the context classloader
*/
public static Path getClassOrigin(Class<?> cls) throws IOException {
final String pluginClassPath = cls.getName().replace('.', '/') + ".class";
URL url = cls.getClassLoader().getResource(pluginClassPath);
if (url == null) {
throw new IOException("Failed to locate the origin of " + cls);
}
String classLocation = url.toExternalForm();
if (url.getProtocol().equals("jar")) {
classLocation = classLocation.substring(4, classLocation.length() - pluginClassPath.length() - 2);
} else {
classLocation = classLocation.substring(0, classLocation.length() - pluginClassPath.length());
}
return urlSpecToPath(classLocation);
}
private static Path urlSpecToPath(String urlSpec) throws IOException {
try {
return Paths.get(new URL(urlSpec).toURI());
} catch (Throwable e) {
throw new IOException(
"Failed to create an instance of " + Path.class.getName() + " from " + urlSpec, e);
}
}
public static ArtifactResolver toJsonArtifactResolver(MavenArtifactResolver mvn) {
return new ArtifactResolver() {
@Override
public List<Dependency> getManagedDependencies(String groupId, String artifactId, String version) {
final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, null, "pom", version);
final List<org.eclipse.aether.graph.Dependency> managedDeps;
try {
managedDeps = mvn.resolveDescriptor(artifact).getManagedDependencies();
} catch (AppModelResolverException e) {
throw new IllegalStateException("Failed to resolve the pom of " + artifact, e);
}
final List<Dependency> result = new ArrayList<>(managedDeps.size());
for(org.eclipse.aether.graph.Dependency dep : managedDeps) {
final Dependency d = new Dependency();
Artifact a = dep.getArtifact();
d.setGroupId(a.getGroupId());
d.setArtifactId(a.getArtifactId());
d.setVersion(a.getVersion());
d.setClassifier(a.getClassifier());
d.setType(a.getExtension());
d.setOptional(d.isOptional());
d.setScope(d.getScope());
result.add(d);
}
return result;
}
@Override
public <T> T process(String groupId, String artifactId, String classifier, String type, String version,
Function<Path, T> processor) {
final DefaultArtifact artifact = new DefaultArtifact(groupId, artifactId, classifier, type, version);
try {
return processor.apply(mvn.resolve(artifact).getArtifact().getFile().toPath());
} catch (AppModelResolverException e) {
throw new IllegalStateException("Failed to resolve " + artifact, e);
}
}
};
}
}

View File

@@ -0,0 +1,18 @@
package io.quarkus.platform.descriptor.loader.json;
import java.nio.file.Path;
import java.util.List;
import java.util.function.Function;
import org.apache.maven.model.Dependency;
public interface ArtifactResolver {
List<Dependency> getManagedDependencies(String groupId, String artifactId, String version);
default <T> T process(String groupId, String artifactId, String version, Function<Path, T> processor) {
return process(groupId, artifactId, null, "jar", version, processor);
}
<T> T process(String groupId, String artifactId, String classifier, String type, String version, Function<Path, T> processor);
}

View File

@@ -1,13 +1,13 @@
package io.quarkus.platform.descriptor.loader.json;
import java.nio.file.Path;
import java.util.function.Function;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
public interface QuarkusJsonPlatformDescriptorLoaderContext extends QuarkusPlatformDescriptorLoaderContext {
Path getJsonDescriptorFile();
<T> T parseJson(Function<Path, T> parser);
MavenArtifactResolver getMavenArtifactResolver();
ArtifactResolver getArtifactResolver();
}

View File

@@ -0,0 +1,20 @@
# Values used in the generated projects
doc-root=https://quarkus.io
# Versions defined in jboss-parent
rest-assured-version=${rest-assured.version}
compiler-plugin-version=${compiler-plugin.version}
surefire-plugin-version=${version.surefire.plugin}
kotlin-version=${kotlin.version}
scala-version=${scala.version}
scala-plugin-version=${scala-plugin.version}
# Plugin metadata
plugin-groupId=${project.groupId}
plugin-artifactId=quarkus-maven-plugin
plugin-version=${project.version}
supported-maven-versions=${supported-maven-versions}
# the proposed version must be in the range of the supported versions
proposed-maven-version=${proposed-maven-version}
maven-wrapper-version=${maven-wrapper.version}
gradle-wrapper-version=${gradle-wrapper.version}

View File

@@ -0,0 +1,156 @@
package io.quarkus.test.platform.descriptor.loader;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import org.apache.maven.model.Dependency;
import io.quarkus.dependencies.Extension;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.ResourceInputStreamConsumer;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
public class QuarkusTestPlatformDescriptorLoader implements QuarkusPlatformDescriptorLoader<QuarkusPlatformDescriptor, QuarkusPlatformDescriptorLoaderContext> {
private static final List<Extension> extensions = new ArrayList<>();
private static final List<Dependency> bomDeps = new ArrayList<>();
private static final Properties quarkusProps;
private static final String quarkusVersion;
private static void addExtension(String artifactId, String name) {
addExtension(artifactId, name, "url://" + name);
}
private static void addExtension(String artifactId, String name, String guide) {
addExtension("io.quarkus", artifactId, quarkusVersion, name, guide);
}
private static void addExtension(String groupId, String artifactId, String version, String name, String guide) {
extensions.add(new Extension(groupId, artifactId, version).setName(name).setGuide(guide));
final Dependency d = new Dependency();
d.setGroupId(groupId);
d.setArtifactId(artifactId);
d.setVersion(version);
bomDeps.add(d);
}
static {
try {
quarkusProps = loadStaticResource("quarkus.properties", is -> {
final Properties props = new Properties();
props.load(is);
return props;
});
} catch (IOException e) {
throw new IllegalStateException("Failed to load quarkus.properties", e);
}
quarkusVersion = quarkusProps.getProperty("plugin-version");
if(quarkusVersion == null) {
throw new IllegalStateException("plugin-version property is missing from quarkus.properties");
}
addExtension("quarkus-agroal", "Agroal");
addExtension("quarkus-arc", "Arc");
addExtension("quarkus-hibernate-orm-panache", "Hibernate ORM Panache");
addExtension("quarkus-hibernate-search-elasticsearch", "Elasticsearch");
addExtension("quarkus-hibernate-validator", "Hibernate Validator");
addExtension("quarkus-jdbc-postgresql", "JDBC PostreSQL");
addExtension("quarkus-jdbc-h2", "JDBC H2");
addExtension("quarkus-resteasy", "RESTEasy", "https://quarkus.io/guides/rest-json-guide");
addExtension("quarkus-smallrye-reactive-messaging", "SmallRye Reactive Messaging");
addExtension("quarkus-smallrye-reactive-streams-operators", "SmallRye Reactive Streams Operators");
addExtension("quarkus-smallrye-opentracing", "SmallRye Opentracing");
addExtension("quarkus-smallrye-metrics", "SmallRye Metrics");
addExtension("quarkus-smallrye-reactive-messaging-kafka", "SmallRye Reactive Messaging Kafka");
addExtension("quarkus-smallrye-health", "SmallRye Health");
addExtension("quarkus-smallrye-openapi", "SmallRye Open API");
addExtension("quarkus-smallrye-jwt", "SmallRye JWT");
addExtension("quarkus-smallrye-context-propagation", "SmallRye Context Propagation");
addExtension("quarkus-smallrye-reactive-type-converters", "SmallRye Reactive Type Converters");
addExtension("quarkus-smallrye-reactive-messaging-amqp", "SmallRye Reactive Messaging AMQP");
addExtension("quarkus-smallrye-fault-tolerance", "SmallRye Fault Tolerance");
addExtension("quarkus-vertx", "Vert.X");
}
@Override
public QuarkusPlatformDescriptor load(QuarkusPlatformDescriptorLoaderContext context) {
return new QuarkusPlatformDescriptor() {
@Override
public String getBomGroupId() {
return "io.quarkus";
}
@Override
public String getBomArtifactId() {
return"quarkus-bom";
}
@Override
public String getBomVersion() {
return quarkusVersion;
}
@Override
public String getQuarkusVersion() {
return quarkusVersion;
}
@Override
public List<Dependency> getManagedDependencies() {
return bomDeps;
}
@Override
public List<Extension> getExtensions() {
return extensions;
}
@Override
public String getTemplate(String name) {
try {
return loadResource(name, is -> {
final StringWriter writer = new StringWriter();
try(BufferedReader reader = new BufferedReader(new InputStreamReader(is)); BufferedWriter bw = new BufferedWriter(writer)) {
String line;
while((line = reader.readLine()) != null) {
bw.write(line);
bw.newLine();
}
}
return writer.getBuffer().toString();
});
} catch (IOException e) {
throw new IllegalStateException("Failed to load resource " + name, e);
}
}
@Override
public <T> T loadResource(String name, ResourceInputStreamConsumer<T> consumer) throws IOException {
return loadStaticResource(name, consumer);
}};
}
private static <T> T loadStaticResource(String name, ResourceInputStreamConsumer<T> consumer) throws IOException {
final InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(name);
if(is == null) {
throw new IOException("Failed to locate resource " + name + " on the classpath");
}
try {
return consumer.handle(is);
} finally {
is.close();
}
}
}

View File

@@ -0,0 +1 @@
io.quarkus.test.platform.descriptor.loader.QuarkusTestPlatformDescriptorLoader

View File

@@ -0,0 +1,42 @@
// this block is necessary to make enforcedPlatform work for Quarkus plugin available
// only locally (snapshot) that is also importing the Quarkus BOM
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "io.quarkus:quarkus-gradle-plugin:${quarkusVersion}"
}
}
plugins {
id 'java'
}
apply plugin: 'io.quarkus'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation enforcedPlatform("${bom_groupId}:${bom_artifactId}:${bom_version}")
implementation 'io.quarkus:quarkus-resteasy'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
nativeTestImplementation 'io.quarkus:quarkus-junit5'
nativeTestImplementation 'io.rest-assured:rest-assured'
}
group '${project_groupId}'
version '${project_version}'
compileJava {
options.compilerArgs << '-parameters'
}

View File

@@ -0,0 +1 @@
quarkusVersion = ${quarkus_version}

View File

@@ -0,0 +1,9 @@
package ${package_name};
import io.quarkus.test.junit.SubstrateTest;
@SubstrateTest
public class Native${class_name}IT extends ${class_name}Test {
// Execute the same tests but in native mode.
}

View File

@@ -0,0 +1,134 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>${project_groupId}</groupId>
<artifactId>${project_artifactId}</artifactId>
<version>${project_version}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>${quarkus_version}</quarkus.version>
<compiler-plugin.version>${compiler_plugin_version}</compiler-plugin.version>
<surefire-plugin.version>${surefire_plugin_version}</surefire-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${bom_groupId}</groupId>
<artifactId>${bom_artifactId}</artifactId>
<version>${bom_version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Quarkus build plugin - also provides the quarkus:dev live-reload feature -->
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<!-- Run the tests in JVM mode -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<!-- Use this profile to build a native executable using GraalVM -->
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
</configuration>
</execution>
</executions>
</plugin>
<!-- Run the tests with the native executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,16 @@
package ${package_name};
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
@Path("${path}")
public class ${class_name} {
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
return "hello";
}
}

View File

@@ -0,0 +1,16 @@
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'io.quarkus') {
useModule("io.quarkus:quarkus-gradle-plugin:${quarkus_version}")
}
}
}
}
rootProject.name='${project_artifactId}'

View File

@@ -0,0 +1,17 @@
package ${package_name};
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
@RestController
@RequestMapping("${path}")
public class ${class_name} {
@GetMapping
public String hello() {
return "hello";
}
}

View File

@@ -0,0 +1,21 @@
package ${package_name};
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class ${class_name}Test {
@Test
public void testHelloEndpoint() {
given()
.when().get("${path}")
.then()
.statusCode(200)
.body(is("hello"));
}
}

View File

@@ -0,0 +1,45 @@
// this block is necessary to make enforcedPlatform work for Quarkus plugin available
// only locally (snapshot) that is also importing the Quarkus BOM
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "io.quarkus:quarkus-gradle-plugin:${quarkusVersion}"
}
}
plugins {
id 'org.jetbrains.kotlin.jvm' version "${kotlin_version}"
}
apply plugin: 'io.quarkus'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation enforcedPlatform("io.quarkus:quarkus-bom:${quarkusVersion}")
implementation 'io.quarkus:quarkus-resteasy'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
nativeTestImplementation 'io.quarkus:quarkus-junit5'
nativeTestImplementation 'io.rest-assured:rest-assured'
}
group '${project_groupId}'
version '${project_version}'
quarkus {
setOutputDirectory("$projectDir/build/classes/kotlin/main")
}
quarkusDev {
setSourceDir("$projectDir/src/main/kotlin")
}

View File

@@ -0,0 +1 @@
quarkusVersion = ${quarkus_version}

View File

@@ -0,0 +1,6 @@
package ${package_name}
import io.quarkus.test.junit.SubstrateTest
@SubstrateTest
open class Native${class_name}IT : ${class_name}Test()

View File

@@ -0,0 +1,176 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>${project_groupId}</groupId>
<artifactId>${project_artifactId}</artifactId>
<version>${project_version}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>${quarkus_version}</quarkus.version>
<compiler-plugin.version>${compiler_plugin_version}</compiler-plugin.version>
<surefire-plugin.version>${surefire_plugin_version}</surefire-plugin.version>
<kotlin.version>${kotlin_version}</kotlin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${plugin_groupId}</groupId>
<artifactId>${bom_artifactId}</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
</dependency>
<!-- Test extensions -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/kotlin</sourceDirectory>
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
<plugins>
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- Soon to be replaced by plugin that will pre-configure all necessary annotations -->
<compilerPlugins>
<plugin>all-open</plugin>
</compilerPlugins>
<pluginOptions>
<!-- Each annotation is placed on its own line -->
<option>all-open:annotation=javax.ws.rs.Path</option>
</pluginOptions>
</configuration>
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-allopen</artifactId>
<version>${kotlin.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,14 @@
package ${package_name}
import javax.ws.rs.GET
import javax.ws.rs.Path
import javax.ws.rs.Produces
import javax.ws.rs.core.MediaType
@Path("${path}")
class ${class_name} {
@GET
@Produces(MediaType.TEXT_PLAIN)
fun hello() = "hello"
}

View File

@@ -0,0 +1,16 @@
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'io.quarkus') {
useModule("io.quarkus:quarkus-gradle-plugin:${quarkus_version}")
}
}
}
}
rootProject.name='${project_artifactId}'

View File

@@ -0,0 +1,20 @@
package ${package_name}
import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test
@QuarkusTest
open class ${class_name}Test {
@Test
fun testHelloEndpoint() {
given()
.`when`().get("${path}")
.then()
.statusCode(200)
.body(`is`("hello"))
}
}

View File

@@ -0,0 +1,36 @@
// this block is necessary to make enforcedPlatform work for Quarkus plugin available
// only locally (snapshot) that is also importing the Quarkus BOM
buildscript {
repositories {
mavenLocal()
}
dependencies {
classpath "io.quarkus:quarkus-gradle-plugin:${quarkusVersion}"
}
}
plugins {
id 'scala'
}
apply plugin: 'io.quarkus'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation enforcedPlatform("io.quarkus:quarkus-bom:${quarkusVersion}")
implementation 'io.quarkus:quarkus-resteasy'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
nativeTestImplementation 'io.quarkus:quarkus-junit5'
nativeTestImplementation 'io.rest-assured:rest-assured'
}
group '${project_groupId}'
version '${project_version}'

View File

@@ -0,0 +1 @@
quarkusVersion = ${quarkus_version}

View File

@@ -0,0 +1,6 @@
package ${package_name}
import io.quarkus.test.junit.SubstrateTest
@SubstrateTest
class Native${class_name}IT extends ${class_name}Test

View File

@@ -0,0 +1,177 @@
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>${project_groupId}</groupId>
<artifactId>${project_artifactId}</artifactId>
<version>${project_version}</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.parameters>true</maven.compiler.parameters>
<quarkus.version>${quarkus_version}</quarkus.version>
<compiler-plugin.version>${compiler_plugin_version}</compiler-plugin.version>
<surefire-plugin.version>${surefire_plugin_version}</surefire-plugin.version>
<scala.version>${scala_version}</scala.version>
<scala-maven-plugin.version>${scala_plugin_version}</scala-maven-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>${plugin_groupId}</groupId>
<artifactId>${bom_artifactId}</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- Test extensions -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>${scala-maven-plugin.version}</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>add-source</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-deprecation</arg>
<arg>-feature</arg>
<arg>-explaintypes</arg>
<arg>-target:jvm-1.8</arg>
<arg>-Ypartial-unification</arg>
</args>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>${plugin_groupId}</groupId>
<artifactId>${plugin_artifactId}</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,12 @@
package ${package_name}
import javax.ws.rs.{GET, Path, Produces}
import javax.ws.rs.core.MediaType
@Path("${path}")
class ${class_name} {
@GET
@Produces(Array[String](MediaType.TEXT_PLAIN))
def hello() = "hello"
}

View File

@@ -0,0 +1,16 @@
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
resolutionStrategy {
eachPlugin {
if (requested.id.id == 'io.quarkus') {
useModule("io.quarkus:quarkus-gradle-plugin:${quarkus_version}")
}
}
}
}
rootProject.name='${project_artifactId}'

View File

@@ -0,0 +1,20 @@
package ${package_name}
import io.quarkus.test.junit.QuarkusTest
import io.restassured.RestAssured.given
import org.hamcrest.CoreMatchers.`is`
import org.junit.jupiter.api.Test
@QuarkusTest
class ${class_name}Test {
@Test
def testHelloEndpoint() = {
given()
.`when`().get("${path}")
.then()
.statusCode(200)
.body(`is`("hello"))
}
}

View File

@@ -0,0 +1,31 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode
#
# Before building the docker image run:
#
# mvn package
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/${project_artifactId}-jvm .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/${project_artifactId}-jvm
#
###
FROM fabric8/java-alpine-openjdk8-jre
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV AB_ENABLED=jmx_exporter
COPY target/lib/* /deployments/lib/
COPY target/*-runner.jar /deployments/app.jar
EXPOSE 8080
# run with user 1001 and be prepared for be running in OpenShift too
RUN adduser -G root --no-create-home --disabled-password 1001 \
&& chown -R 1001 /deployments \
&& chmod -R "g+rwX" /deployments \
&& chown -R 1001:root /deployments
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]

View File

@@ -0,0 +1,22 @@
####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
#
# Before building the docker image run:
#
# mvn package -Pnative -Dnative-image.docker-build=true
#
# Then, build the image with:
#
# docker build -f src/main/docker/Dockerfile.native -t quarkus/${project_artifactId} .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/${project_artifactId}
#
###
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY target/*-runner /work/application
RUN chmod 775 /work
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@@ -0,0 +1,4 @@
*
!target/*-runner
!target/*-runner.jar
!target/lib/*

View File

@@ -0,0 +1,29 @@
# Eclipse
.project
.classpath
.settings/
bin/
# IntelliJ
.idea
*.ipr
*.iml
*.iws
# NetBeans
nb-configuration.xml
# Visual Studio Code
.vscode
# OSX
.DS_Store
# Vim
*.swp
*.swo
# patch
*.orig
*.rej
${additional_gitignore_entries}

View File

@@ -0,0 +1,152 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>${project_artifactId} - ${project_version}</title>
<style>
h1, h2, h3, h4, h5, h6 {
margin-bottom: 0.5rem;
font-weight: 400;
line-height: 1.5;
}
h1 {
font-size: 2.5rem;
}
h2 {
font-size: 2rem
}
h3 {
font-size: 1.75rem
}
h4 {
font-size: 1.5rem
}
h5 {
font-size: 1.25rem
}
h6 {
font-size: 1rem
}
.lead {
font-weight: 300;
font-size: 2rem;
}
.banner {
font-size: 2.7rem;
margin: 0;
padding: 2rem 1rem;
background-color: #00A1E2;
color: white;
}
body {
margin: 0;
font-family: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
code {
font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
font-size: 87.5%;
color: #e83e8c;
word-break: break-word;
}
.left-column {
padding: .75rem;
max-width: 75%;
min-width: 55%;
}
.right-column {
padding: .75rem;
max-width: 25%;
}
.container {
display: flex;
width: 100%;
}
li {
margin: 0.75rem;
}
.right-section {
margin-left: 1rem;
padding-left: 0.5rem;
}
.right-section h3 {
padding-top: 0;
font-weight: 200;
}
.right-section ul {
border-left: 0.3rem solid #00A1E2;
list-style-type: none;
padding-left: 0;
}
</style>
</head>
<body>
<div class="banner lead">
Your new Cloud-Native application is ready!
</div>
<div class="container">
<div class="left-column">
<p class="lead"> Congratulations, you have created a new Quarkus application.</p>
<h2>Why do you see this?</h2>
<p>This page is served by Quarkus. The source is in
<code>src/main/resources/META-INF/resources/index.html</code>.</p>
<h2>What can I do from here?</h2>
<p>If not already done, run the application in <em>dev mode</em> using: <code>mvn compile quarkus:dev</code>.
</p>
<ul>
<li>Add REST resources, Servlets, functions and other services in <code>src/main/java</code>.</li>
<li>Your static assets are located in <code>src/main/resources/META-INF/resources</code>.</li>
<li>Configure your application in <code>src/main/resources/application.properties</code>.
</li>
</ul>
<h2>How do I get rid of this page?</h2>
<p>Just delete the <code>src/main/resources/META-INF/resources/index.html</code> file.</p>
</div>
<div class="right-column">
<div class="right-section">
<h3>Application</h3>
<ul>
<li>GroupId: ${project_groupId}</li>
<li>ArtifactId: ${project_artifactId}</li>
<li>Version: ${project_version}</li>
<li>Quarkus Version: ${quarkus_version}</li>
</ul>
</div>
<div class="right-section">
<h3>Next steps</h3>
<ul>
<li><a href="${doc_root}/guides/maven-tooling.html" target="_blank">Setup your IDE</a></li>
<li><a href="${doc_root}/guides/getting-started-guide.html" target="_blank">Getting started</a></li>
<li><a href="${doc_root}" target="_blank">Quarkus Web Site</a></li>
</ul>
</div>
</div>
</div>
</body>
</html>

View File

@@ -27,15 +27,16 @@ public class Extension {
private String name;
private String description;
private String guide;
private boolean unlisted;
private String simplifiedArtifactId;
private static final Pattern QUARKUS_PREFIX = Pattern.compile("^quarkus-");
private String shortName;
private Map<String, Object> metadata = new HashMap<String, Object>(3);
public Extension() {
// Use by mapper.
}
@@ -102,14 +103,15 @@ public class Extension {
}
public String[] getLabels() {
List<String> keywords = (List<String>) getMetadata().get("keywords");
@SuppressWarnings("unchecked")
List<String> keywords = (List<String>) getMetadata().get("keywords");
if(keywords != null) {
return (String[]) keywords.toArray(new String[keywords.size()]);
}
return null;
return new String[0];
}
public Extension setLabels(String[] labels) {
public Extension setLabels(String... labels) {
getMetadata().put("keywords", Arrays.asList(labels));
return this;
}
@@ -135,12 +137,12 @@ public class Extension {
public Map<String, Object> getMetadata() {
return metadata;
}
public Extension setMetadata(Map<String, Object> metadata) {
this.metadata = metadata;
return this;
}
public List<String> labels() {
List<String> list = new ArrayList<>();
String[] labels = getLabels();
@@ -241,7 +243,7 @@ public class Extension {
this.guide = guide;
return this;
}
public String getGuide() {
return guide;
}

View File

@@ -13,14 +13,15 @@ class ExtensionSerializerTest {
@Test
void testLegacyLabelsMapToKeywords() {
Extension e = new Extension();
String[] input = new String[] { "what", "not", "to", "do"};
e.setLabels(input);
List<String> list = (List<String>) e.getMetadata().get("keywords");
assertNotNull(list);
@SuppressWarnings("unchecked")
List<String> list = (List<String>) e.getMetadata().get("keywords");
assertNotNull(list);
assertArrayEquals(input, list.toArray(new String[0]));
assertArrayEquals(input,e.getLabels());
}

View File

@@ -10,7 +10,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>quarkus-descriptor-resolver-json</artifactId>
<artifactId>quarkus-platform-descriptor-resolver-json</artifactId>
<name>Quarkus - Dev tools - Platform JSON descriptor resolver</name>
<dependencies>
@@ -26,10 +26,13 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-common</artifactId>
</dependency>
<!--
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
<version>${quarkus.version}</version>
</dependency>
-->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>

View File

@@ -11,6 +11,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.ServiceLoader;
import java.util.function.Function;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
@@ -26,7 +27,9 @@ import com.eclipsesource.json.WriterConfig;
import io.quarkus.bootstrap.resolver.AppModelResolverException;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.maven.utilities.MojoUtils;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.json.ArtifactResolver;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.loader.json.QuarkusJsonPlatformDescriptorLoaderContext;
import io.quarkus.platform.tools.DefaultMessageWriter;
@@ -126,7 +129,7 @@ public class QuarkusJsonPlatformDescriptorResolver {
// Resolve the platform JSON artifact
Artifact jsonArtifact = new DefaultArtifact(jsonGroupId, jsonArtifactId, null, "json", jsonVersion);
log.info("Platform JSON artifact: %s", jsonArtifact);
log.debug("Platform JSON artifact: %s", jsonArtifact);
final File jsonFile;
try {
jsonFile = mvn.resolve(jsonArtifact).getArtifact().getFile();
@@ -194,20 +197,21 @@ public class QuarkusJsonPlatformDescriptorResolver {
if(i.hasNext()) {
throw new IllegalStateException("Located more than one implementation of " + QuarkusJsonPlatformDescriptorLoader.class.getName());
}
final ArtifactResolver loaderResolver = MojoUtils.toJsonArtifactResolver(mvn);
platform = jsonDescrLoader.load(new QuarkusJsonPlatformDescriptorLoaderContext() {
@Override
public Path getJsonDescriptorFile() {
return jsonFile.toPath();
}
@Override
public MavenArtifactResolver getMavenArtifactResolver() {
return mvn;
public <T> T parseJson(Function<Path, T> parser) {
return parser.apply(jsonFile.toPath());
}
@Override
public MessageWriter getMessageWriter() {
return log;
}
@Override
public ArtifactResolver getArtifactResolver() {
return loaderResolver;
}});
} finally {
try {

View File

@@ -1,37 +1,16 @@
package io.quarkus.platform.descriptor.resolver.json.demo;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.QuarkusPlatformDescriptorLoaderContext;
import io.quarkus.platform.descriptor.loader.legacy.QuarkusLegacyPlatformDescriptor;
import io.quarkus.platform.descriptor.loader.legacy.QuarkusLegacyPlatformDescriptorLoader;
import io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver;
import io.quarkus.platform.tools.DefaultMessageWriter;
import io.quarkus.platform.tools.MessageWriter;
public class JsonDescriptorResolverDemo {
private static final String IO_QUARKUS = "io.quarkus";
private static final String LAUNCHER_GROUP_ID = IO_QUARKUS;
private static final String LAUNCHER_ARTIFACT_ID = "quarkus-tools-launcher";
private static final String LAUNCHER_POM_PROPS_PATH = "META-INF/maven/" + LAUNCHER_GROUP_ID + "/" + LAUNCHER_ARTIFACT_ID + "/pom.properties";
public static void main(String... args) throws Exception {
final DefaultMessageWriter log = new DefaultMessageWriter();
log.setDebugEnabled(true);
final String version = determineLauncherVersion(log);
if(version == null) {
log.info(errorFailedToDetermineLauncherVersion());
} else {
log.info("Tools Launcher Version: %s", version);
}
final QuarkusPlatformDescriptor platform = QuarkusJsonPlatformDescriptorResolver.newInstance()
.setMessageWriter(log)
.setPlatformJsonArtifactId("quarkus-bom-descriptor-json")
@@ -42,36 +21,5 @@ public class JsonDescriptorResolverDemo {
log.info("Managed deps total: " + platform.getManagedDependencies().size());
log.info(platform.getTemplate("templates/basic-rest/java/resource-template.ftl"));
final QuarkusLegacyPlatformDescriptorLoader legacyLoader = new QuarkusLegacyPlatformDescriptorLoader();
final QuarkusLegacyPlatformDescriptor legacy = legacyLoader.load(new QuarkusPlatformDescriptorLoaderContext() {
@Override
public MessageWriter getMessageWriter() {
return log;
}});
log.info("Legacy platform BOM: " + legacy.getBomGroupId() + ":" + legacy.getBomArtifactId() + ":" + legacy.getBomVersion());
log.info("Extensions total: " + legacy.getExtensions().size());
log.info("Managed deps total: " + legacy.getManagedDependencies().size());
log.info(platform.getTemplate("/templates/basic-rest/java/pom.xml-template.ftl"));
}
private static String determineLauncherVersion(MessageWriter log) throws IOException {
final InputStream launcherPomPropsIs = Thread.currentThread().getContextClassLoader().getResourceAsStream(LAUNCHER_POM_PROPS_PATH);
if(launcherPomPropsIs == null) {
log.debug("Failed to locate %s on the classpath", LAUNCHER_POM_PROPS_PATH);
return null;
}
try {
final Properties props = new Properties();
props.load(launcherPomPropsIs);
return props.getProperty("version");
} finally {
launcherPomPropsIs.close();
}
}
private static String errorFailedToDetermineLauncherVersion() {
return "Failed to determine the version of Quarkus Tools Launcher";
}
}

View File

@@ -0,0 +1,25 @@
package io.quarkus.platform.descriptor.resolver.json.demo;
import io.quarkus.platform.descriptor.QuarkusPlatformDescriptor;
import io.quarkus.platform.tools.DefaultMessageWriter;
import io.quarkus.platform.tools.config.QuarkusPlatformConfig;
public class QuarkusPlatformConfigDemo {
public static void main(String... args) throws Exception {
final DefaultMessageWriter log = new DefaultMessageWriter();
log.setDebugEnabled(true);
final QuarkusPlatformDescriptor platform = QuarkusPlatformConfig.defaultConfigBuilder()
.setMessageWriter(log)
.build()
.getPlatformDescriptor();
log.info("Platform BOM: " + platform.getBomGroupId() + ":" + platform.getBomArtifactId() + ":" + platform.getBomVersion());
log.info("Extensions total: " + platform.getExtensions().size());
log.info("Managed deps total: " + platform.getManagedDependencies().size());
log.info(platform.getTemplate("templates/basic-rest/java/resource-template.ftl"));
}
}

View File

@@ -75,16 +75,6 @@
<artifactId>quarkus-platform-descriptor-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-devtools-templates</artifactId>
<version>${quarkus.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<version>${quarkus.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus.http</groupId>
<artifactId>quarkus-http-websockets-jsr</artifactId>

View File

@@ -19,6 +19,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kogito-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-maven</artifactId>

View File

@@ -19,6 +19,11 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-kotlin-deployment</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-maven</artifactId>

View File

@@ -16,7 +16,6 @@ import org.junit.jupiter.api.Test;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import io.quarkus.maven.CreateProjectMojo;
import io.quarkus.maven.it.MojoTestBase;
import io.quarkus.maven.utilities.MojoUtils;
@@ -77,7 +76,7 @@ public class KotlinCreateMavenProjectIT extends MojoTestBase {
InvocationRequest request = new DefaultInvocationRequest();
request.setBatchMode(true);
request.setGoals(Collections.singletonList(
CreateProjectMojo.getPluginKey() + ":" + MojoUtils.getPluginVersion() + ":create"));
MojoUtils.getPluginKey() + ":" + MojoUtils.getPluginVersion() + ":create"));
request.setProperties(params);
getEnv().forEach(request::addShellEnvironment);
File log = new File(testDir, "build-create-" + testDir.getName() + ".log");

View File

@@ -25,6 +25,12 @@
<artifactId>quarkus-bom-descriptor-json</artifactId>
<version>${project.version}</version>
<type>json</type>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
@@ -42,6 +48,24 @@
</resource>
</resources>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-json-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>validate-extensions-json</goal>
</goals>
<configuration>
<jsonGroupId>io.quarkus</jsonGroupId>
<jsonArtifactId>quarkus-bom-descriptor-json</jsonArtifactId>
<jsonVersion>${project.version}</jsonVersion>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
@@ -69,8 +93,18 @@
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<artifactId>quarkus-platform-descriptor-json</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bootstrap-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.maven</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
@@ -94,13 +128,6 @@
<project.version>${project.version}</project.version>
</systemPropertyVariables>
</configuration>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-platform-descriptor-legacy</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

Some files were not shown because too many files have changed in this diff Show More