mirror of
https://github.com/jlengrand/quarkus.git
synced 2026-03-10 08:41:22 +00:00
Installing plugin in maven local repo
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>quarkus-gradle-plugin</artifactId>
|
||||
<artifactId>io.quarkus.gradle.plugin</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>Quarkus - Gradle Plugin</name>
|
||||
<description>Quarkus - Gradle Plugin</description>
|
||||
@@ -19,8 +19,6 @@
|
||||
<gradle.executable>./gradlew</gradle.executable>
|
||||
<gradle.task>build</gradle.task>
|
||||
<skip.gradle.build>false</skip.gradle.build>
|
||||
<maven.install.skip>true</maven.install.skip>
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -79,6 +77,38 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-artifacts</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>attach-artifact</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifacts>
|
||||
<artifact>
|
||||
<file>build/libs/quarkus-gradle-plugin-${project.version}.jar</file>
|
||||
<type>jar</type>
|
||||
</artifact>
|
||||
<artifact>
|
||||
<file>build/libs/quarkus-gradle-plugin-${project.version}-javadoc.jar</file>
|
||||
<type>jar</type>
|
||||
<classifier>javadoc</classifier>
|
||||
</artifact>
|
||||
<artifact>
|
||||
<file>build/libs/quarkus-gradle-plugin-${project.version}-sources.jar</file>
|
||||
<type>jar</type>
|
||||
<classifier>sources</classifier>
|
||||
</artifact>
|
||||
</artifacts>
|
||||
<skipAttach>${skip.gradle.build}</skipAttach>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Do not deploy this project-->
|
||||
<plugin>
|
||||
<groupId>org.sonatype.plugins</groupId>
|
||||
|
||||
@@ -36,6 +36,7 @@ import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.artifacts.DependencySet;
|
||||
import org.gradle.api.artifacts.ProjectDependency;
|
||||
import org.gradle.api.artifacts.ResolvedDependency;
|
||||
import org.gradle.api.plugins.Convention;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
@@ -248,6 +249,11 @@ public class QuarkusDev extends QuarkusTask {
|
||||
wiringClassesDirectory.mkdirs();
|
||||
addToClassPaths(classPathManifest, context, wiringClassesDirectory);
|
||||
|
||||
//we also want to add the maven plugin jar to the class path
|
||||
//this allows us to just directly use classes, without messing around copying them
|
||||
//to the runner jar
|
||||
addGradlePluginDeps(classPathManifest, context);
|
||||
|
||||
//now we need to build a temporary jar to actually run
|
||||
|
||||
File tempFile = new File(getBuildDir(), extension.finalName() + "-dev.jar");
|
||||
@@ -388,6 +394,18 @@ public class QuarkusDev extends QuarkusTask {
|
||||
}
|
||||
}
|
||||
|
||||
private void addGradlePluginDeps(StringBuilder classPathManifest, DevModeContext context) {
|
||||
Configuration conf = getProject().getBuildscript().getConfigurations().getByName("classpath");
|
||||
ResolvedDependency quarkusDep = conf.getResolvedConfiguration().getFirstLevelModuleDependencies().stream()
|
||||
.filter(rd -> "io.quarkus.gradle.plugin".equals(rd.getModuleName()))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Unable to find quarkus-gradle-plugin dependency"));
|
||||
|
||||
quarkusDep.getAllModuleArtifacts().stream()
|
||||
.map(ra -> ra.getFile())
|
||||
.forEach(f -> addToClassPaths(classPathManifest, context, f));
|
||||
}
|
||||
|
||||
private void addToClassPaths(StringBuilder classPathManifest, DevModeContext context, File file) {
|
||||
if (filesIncludedInClasspath.add(file)) {
|
||||
getProject().getLogger().info("Adding dependency {}", file);
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
}
|
||||
rootProject.name='${project_artifactId}'
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
}
|
||||
rootProject.name='${project_artifactId}'
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
pluginManagement {
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
plugins {
|
||||
id 'io.quarkus' version "${quarkusPluginVersion}"
|
||||
}
|
||||
}
|
||||
rootProject.name='${project_artifactId}'
|
||||
|
||||
@@ -85,6 +85,11 @@ public class GradleBuildFile extends BuildFile {
|
||||
if (!settingsContent.contains("id 'io.quarkus'")) {
|
||||
res.append(System.lineSeparator());
|
||||
res.append("pluginManagement {").append(System.lineSeparator());
|
||||
res.append(" repositories {").append(System.lineSeparator());
|
||||
res.append(" mavenLocal()").append(System.lineSeparator());
|
||||
res.append(" mavenCentral()").append(System.lineSeparator());
|
||||
res.append(" gradlePluginPortal()").append(System.lineSeparator());
|
||||
res.append(" }").append(System.lineSeparator());
|
||||
res.append(" plugins {").append(System.lineSeparator());
|
||||
res.append(" id 'io.quarkus' version \"${quarkusPluginVersion}\"").append(System.lineSeparator());
|
||||
res.append(" }").append(System.lineSeparator());
|
||||
|
||||
Reference in New Issue
Block a user