Skip to content

Commit d0c3dee

Browse files
committed
Jooby start of console generator app
1 parent 13cdedd commit d0c3dee

File tree

6 files changed

+151
-0
lines changed

6 files changed

+151
-0
lines changed

modules/jooby-cli/pom.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
6+
<parent>
7+
<groupId>io.jooby</groupId>
8+
<artifactId>modules</artifactId>
9+
<version>2.0.6-SNAPSHOT</version>
10+
</parent>
11+
12+
<modelVersion>4.0.0</modelVersion>
13+
<artifactId>jooby-cli</artifactId>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>com.google.code.findbugs</groupId>
18+
<artifactId>jsr305</artifactId>
19+
<scope>provided</scope>
20+
</dependency>
21+
22+
<!-- https://mvnrepository.com/artifact/info.picocli/picocli -->
23+
<dependency>
24+
<groupId>info.picocli</groupId>
25+
<artifactId>picocli</artifactId>
26+
<version>4.0.2</version>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>org.junit.jupiter</groupId>
31+
<artifactId>junit-jupiter-engine</artifactId>
32+
<scope>test</scope>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>org.jacoco</groupId>
37+
<artifactId>org.jacoco.agent</artifactId>
38+
<classifier>runtime</classifier>
39+
<scope>test</scope>
40+
</dependency>
41+
</dependencies>
42+
43+
<build>
44+
<plugins>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<artifactId>maven-compiler-plugin</artifactId>
48+
<configuration>
49+
<annotationProcessorPaths>
50+
<path>
51+
<groupId>info.picocli</groupId>
52+
<artifactId>picocli-codegen</artifactId>
53+
<version>4.0.2</version>
54+
</path>
55+
</annotationProcessorPaths>
56+
<compilerArgs>
57+
<arg>-Aproject=${groupId}/${artifactId}</arg>
58+
</compilerArgs>
59+
</configuration>
60+
</plugin>
61+
</plugins>
62+
</build>
63+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package io.jooby.cli;
2+
3+
import picocli.CommandLine;
4+
5+
@CommandLine.Command(name = "jooby", mixinStandardHelpOptions = true, description = "jooby console", subcommands = {
6+
CreateApp.class})
7+
public class Cli implements Runnable {
8+
@CommandLine.Spec CommandLine.Model.CommandSpec spec;
9+
10+
public void run() {
11+
throw new CommandLine.ParameterException(spec.commandLine(), "Missing required subcommand");
12+
}
13+
14+
public static void main(String[] args) {
15+
int exitCode = new CommandLine(new Cli())
16+
.execute(args);
17+
System.exit(exitCode);
18+
}
19+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.jooby.cli;
2+
3+
import picocli.CommandLine;
4+
5+
@CommandLine.Command(name = "create", mixinStandardHelpOptions = true, description = "Creates a new application")
6+
public class CreateApp implements Runnable {
7+
@CommandLine.Parameters
8+
private String name;
9+
10+
@CommandLine.Option(names = {"-m", "--maven"}, defaultValue = "true")
11+
private boolean maven;
12+
13+
@CommandLine.Option(names = {"-g", "--gradle"})
14+
private boolean gradle;
15+
16+
@Override public void run() {
17+
System.out.println(name);
18+
System.out.println(maven);
19+
System.out.println(gradle);
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Application configuration file
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<artifactId>${artifactId}</artifactId>
9+
<groupId>${groupId}</groupId>
10+
<version>${version}</version>
11+
12+
<properties>
13+
<jooby.version>${joobyVersion}</jooby.version>
14+
<!-- Startup class -->
15+
<application.class>${applicationClass}</application.class>
16+
</properties>
17+
18+
<dependencies>
19+
<!-- Server -->
20+
<dependency>
21+
<groupId>io.jooby</groupId>
22+
<artifactId>jooby-netty</artifactId>
23+
</dependency>
24+
25+
<dependency>
26+
<groupId>ch.qos.logback</groupId>
27+
<artifactId>logback-classic</artifactId>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<plugins>
33+
<!-- uber jar -->
34+
<plugin>
35+
<groupId>org.apache.maven.plugins</groupId>
36+
<artifactId>maven-shade-plugin</artifactId>
37+
</plugin>
38+
39+
<plugin>
40+
<groupId>io.jooby</groupId>
41+
<artifactId>jooby-maven-plugin</artifactId>
42+
<version>${joobyVersion}</version>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
</project>

modules/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<module>jooby-archetype</module>
4242

4343
<module>jooby-run</module>
44+
<module>jooby-cli</module>
4445
<module>jooby-maven-plugin</module>
4546
<module>jooby-gradle-plugin</module>
4647
</modules>

0 commit comments

Comments
 (0)