larsquitsch
Returning Observer

start servermanager via gradle task

Jump to solution

Hallo,

it is possible to start a sitearchitect with a gradle task via the bootstrap class. Is it also possible to start the ServerManager this way?

Kind regards and thank you,

Lars

0 Kudos
1 Solution

Accepted Solutions
Windmüller
Crownpeak employee

Yes, it is possible. However, this is not a documented feature and may therefore break without notice.

 

val clientRuntime: Configuration by configurations.creating

dependencies {
    clientRuntime(group = "de.espirit.firstspirit", name = "fs-isolated-client", version = "<insert-your-fs-version-here>")
}

fun clientStartArgs(registryFile: String): List<String> {
    val baseArgs = listOf(
            "-Xmx512m",
            "-Djava.security.manager=allow",
            "-Dcheckedtviolation=1",
            "-DlogLevel=DEBUG",
            "-Dlocale=" + Locale.getDefault().language,
            "-Dregistry.file=$registryFile",
            "--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED",
            "--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing.table=ALL-UNNAMED"
    )
    return baseArgs + listOf(
            "-Dhost=localhost",
            "-Dport=1088",
            "-Dmode=socket",
            "-Dlogin=plain",
            "-Dlogin.user=Admin",
            "-Dlogin.password=your-password"
    )
}

/*
    WARNING: Starting FirstSpirit clients this way is undocumented and may change without notice!
 */

val startSiteArchitect by tasks.creating(JavaExec::class.java) {
    classpath = files(clientRuntime)
    mainClass.set("de.espirit.common.bootstrap.Bootstrap")
    jvmArgs = clientStartArgs("FactoryRegistry.properties")
}

val startServerManager by tasks.creating(JavaExec::class.java) {
    classpath = files(clientRuntime)
    mainClass.set("de.espirit.common.bootstrap.Bootstrap")
    jvmArgs = clientStartArgs("AdminManager.properties")
}

View solution in original post

0 Kudos
2 Replies
Windmüller
Crownpeak employee

Yes, it is possible. However, this is not a documented feature and may therefore break without notice.

 

val clientRuntime: Configuration by configurations.creating

dependencies {
    clientRuntime(group = "de.espirit.firstspirit", name = "fs-isolated-client", version = "<insert-your-fs-version-here>")
}

fun clientStartArgs(registryFile: String): List<String> {
    val baseArgs = listOf(
            "-Xmx512m",
            "-Djava.security.manager=allow",
            "-Dcheckedtviolation=1",
            "-DlogLevel=DEBUG",
            "-Dlocale=" + Locale.getDefault().language,
            "-Dregistry.file=$registryFile",
            "--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED",
            "--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED",
            "--add-exports=java.desktop/sun.swing.table=ALL-UNNAMED"
    )
    return baseArgs + listOf(
            "-Dhost=localhost",
            "-Dport=1088",
            "-Dmode=socket",
            "-Dlogin=plain",
            "-Dlogin.user=Admin",
            "-Dlogin.password=your-password"
    )
}

/*
    WARNING: Starting FirstSpirit clients this way is undocumented and may change without notice!
 */

val startSiteArchitect by tasks.creating(JavaExec::class.java) {
    classpath = files(clientRuntime)
    mainClass.set("de.espirit.common.bootstrap.Bootstrap")
    jvmArgs = clientStartArgs("FactoryRegistry.properties")
}

val startServerManager by tasks.creating(JavaExec::class.java) {
    classpath = files(clientRuntime)
    mainClass.set("de.espirit.common.bootstrap.Bootstrap")
    jvmArgs = clientStartArgs("AdminManager.properties")
}
0 Kudos

Vielen Dank @Windmüller , funktioniert einwandfrei!

Für alle die kein Kotlin nutzen und auf Basis des Modultemplates arbeiten, es reicht die Zeile 

"-Dregistry.file=FactoryRegistry.properties",
zu
"-Dregistry.file=AdminManager.properties",

zu ändern.
 

0 Kudos