diff options
3 files changed, 48 insertions, 29 deletions
diff --git a/module/ri-engine/pom.xml b/module/ri-engine/pom.xml index 97fee1c..d17f83e 100644 --- a/module/ri-engine/pom.xml +++ b/module/ri-engine/pom.xml @@ -3,6 +3,9 @@ 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> + <properties> + <main-class>io.trygvis.rules.engine.Main</main-class> + </properties> <parent> <groupId>io.trygvis.rules-sandbox</groupId> @@ -34,22 +37,6 @@ <groupId>org.kie</groupId> <artifactId>kie-ci</artifactId> </dependency> - <!-- - <dependency> - <groupId>org.drools</groupId> - <artifactId>drools-mvel</artifactId> - <exclusions> - <exclusion> - <groupId>org.kie</groupId> - <artifactId>kie-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.kie</groupId> - <artifactId>kie-internal</artifactId> - </exclusion> - </exclusions> - </dependency> - --> <dependency> <groupId>ch.qos.logback</groupId> @@ -115,16 +102,21 @@ </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> + <artifactId>maven-shade-plugin</artifactId> + <version>3.2.4</version> <executions> <execution> - <id>copy-dependencies</id> - <phase>prepare-package</phase> + <phase>package</phase> <goals> - <goal>copy-dependencies</goal> + <goal>shade</goal> </goals> <configuration> - <outputDirectory>${project.build.directory}/lib</outputDirectory> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/kie.conf</resource> + </transformer> + </transformers> + <outputFile>${project.build.directory}/${project.artifactId}-${project.version}-fat.jar</outputFile> </configuration> </execution> </executions> @@ -136,13 +128,42 @@ <configuration> <archive> <manifest> - <addClasspath>true</addClasspath> - <classpathPrefix>lib/</classpathPrefix> - <mainClass>io.trygvis.rules.engine.Main</mainClass> + <mainClass>${main-class}</mainClass> </manifest> </archive> </configuration> </plugin> + + <!-- TODO: attach generated script to build --> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <version>1.6.0</version> + <executions> + <execution> + <id>generate-autocompletion-script</id> + <phase>package</phase> + <goals> + <!-- The java goal doesn't work here as maven itself would have to run with enable-preview --> + <goal>exec</goal> + </goals> + </execution> + </executions> + <configuration> + <executable>java</executable> + <arguments> + <argument>-Dpicocli.autocomplete.systemExitOnError</argument> + <argument>--enable-preview</argument> + <argument>-cp</argument> + <classpath/> + <argument>picocli.AutoComplete</argument> + <argument>--force</argument> + <argument>--completionScript</argument> + <argument>${project.build.directory}/engine_completion.sh</argument> + <argument>${main-class}</argument> + </arguments> + </configuration> + </plugin> </plugins> </build> </project> diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java b/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java index 3db1625..e5b9606 100644 --- a/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java +++ b/module/ri-engine/src/main/java/io/trygvis/rules/engine/Engine.java @@ -26,6 +26,8 @@ public class Engine implements Closeable { var services = KieServices.Factory.get(); + logger.info("services = {}", services); + ReleaseId releaseId = null; for (File path : (modules == null ? new File[0] : modules)) { logger.info("New KieBuilder: {}", path); diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/engine/cli/RunCommand.java b/module/ri-engine/src/main/java/io/trygvis/rules/engine/cli/RunCommand.java index 345d8b8..2b016f2 100644 --- a/module/ri-engine/src/main/java/io/trygvis/rules/engine/cli/RunCommand.java +++ b/module/ri-engine/src/main/java/io/trygvis/rules/engine/cli/RunCommand.java @@ -26,12 +26,11 @@ public class RunCommand implements Callable<Integer> { @Option(names = {"--agenda-groups"}) public String[] agendaGroups; - @Option(names = {"--modules"}, split = ",") + @Option(names = {"--modules"}, split = ",", arity = "1..*") public File[] modules; @Override public Integer call() throws Exception { - System.out.println("RunCommand.call"); if (agendaGroups == null || agendaGroups.length == 0) { agendaGroups = new String[]{"init", "generate"}; @@ -45,11 +44,8 @@ public class RunCommand implements Callable<Integer> { o.getClass().getSimpleName().contains("Ipv4Cidr") || o.getClass().getSimpleName().contains("Ipv4Address") ); - System.out.println("RunCommand.call"); } - System.out.println("RunCommand.call"); - return 0; } } |