Remove IDELauncher. Use org.keycloak.Keycloak

closes #35913

Signed-off-by: Christian Janker <christian.janker@gmx.at>
This commit is contained in:
Christian Ja
2025-01-27 10:42:04 +01:00
committed by GitHub
parent 4965f40994
commit 610587248b
4 changed files with 13 additions and 73 deletions

View File

@@ -59,7 +59,16 @@ For development purposes, you can run the server in development mode instead usi
This spins up Keycloak using a development database (h2-file) and with insecure HTTP enabled.
### Running from your IDE
Alternatively, you can run the server in development mode from your IDE. For that, run the `org.keycloak.quarkus._private.IDELauncher` main class in the `server` directory.
Alternatively, you can run the server in development mode from your IDE. For that, run the `org.keycloak.Keycloak` main class in the `tests/junit5` directory.
If you have problems starting the server in debug mode, add following environment variables to your run config:
-Djava.util.logging.manager=org.jboss.logmanager.LogManager
-Djava.util.concurrent.ForkJoinPool.common.threadFactory=io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory
Set the `kc.home.dir` environment variable for keeping state between startups:
-Dkc.home.dir=.kc
## Contributing
Please make sure to read our [Contribution Guidelines](../CONTRIBUTING.md) before contributing.

View File

@@ -33,19 +33,6 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<!-- Necessary for proper execution of IDELauncher -->
<!-- Can be removed as part of the https://github.com/keycloak/keycloak/issues/22455 enhancement -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-resources</artifactId>
<scope>provided</scope>
</dependency>
<!-- this dependency is necessary to start the IDELauncher -->
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc11</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.mvnpm</groupId>
<artifactId>importmap</artifactId>

View File

@@ -1,59 +0,0 @@
package org.keycloak.quarkus._private;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import org.keycloak.quarkus.runtime.KeycloakMain;
import org.keycloak.quarkus.runtime.cli.Picocli;
import io.quarkus.runtime.Quarkus;
/**
* <p>This main class should be used to start the server in dev mode for development purposes. By running this class,
* developers should be able to mimic any server behavior and configuration as if they were using the CLI.
*
* <p>There are some limitations during development such as:
*
* <ul>
* <li>Transient dependencies from the keycloak server extension (runtime module) are not eligible for hot-reload</li>
* <li>Code changes such as changing the structure of classes (e.g.: new/change methods) should still require a JVM restart</li>
* </ul>
*
* <p>Despite the limitations, it should be possible to debug the extension (e.g.: deployment steps) as well as perform changes at runtime
* without having to restart the JVM.
*
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class IDELauncher {
public static void main(String[] args) {
if (System.getProperty("java.util.logging.manager") == null) {
System.setProperty("java.util.logging.manager", "org.jboss.logmanager.LogManager");
}
if (System.getProperty("picocli.disable.closures") == null) {
System.setProperty("picocli.disable.closures", "true");
}
if (System.getProperty("java.util.concurrent.ForkJoinPool.common.threadFactory") == null) {
System.setProperty("java.util.concurrent.ForkJoinPool.common.threadFactory", "io.quarkus.bootstrap.forkjoin.QuarkusForkJoinWorkerThreadFactory");
}
List<String> devArgs = new ArrayList<>(Picocli.parseArgs(args));
if (System.getProperty("kc.home.dir") == null) {
// direct the auto-created files to the target folder, so they are cleaned by "mvn clean"
// users can still provide a different folder by setting the property when starting it from their IDE.
Path path = Paths.get(System.getProperty("user.dir"), "target", "kc");
System.setProperty("kc.home.dir", path.toAbsolutePath().toString());
}
if (devArgs.isEmpty()) {
devArgs.add("start-dev");
}
Quarkus.run(KeycloakMain.class, devArgs.toArray(new String[devArgs.size()]));
}
}

View File

@@ -114,6 +114,9 @@ public class Keycloak {
}
List<String> args = new ArrayList<>(rawArgs);
if (args.isEmpty()) {
args.add("start-dev");
}
addOptionIfNotSet(args, HttpOptions.HTTP_ENABLED, true);
addOptionIfNotSet(args, HttpOptions.HTTP_PORT);