Skip to content

Commit e55e270

Browse files
committed
feat: added bunch of useful properties to AppInfo
These properties are not used (right now) but are useful metadata to have around for future use.
1 parent a00302d commit e55e270

File tree

2 files changed

+68
-16
lines changed

2 files changed

+68
-16
lines changed

app.yml

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
1-
dependencies:
2-
eu.maveniverse.maven.mima:context: "2.4.33"
3-
eu.maveniverse.maven.mima.runtime:standalone-static: "2.4.33"
4-
org.apache.maven.indexer:search-backend-smo: "7.1.6"
5-
info.picocli:picocli: "4.7.7"
6-
org.yaml:snakeyaml: "2.4"
7-
org.jline:jline-console-ui: "3.30.5"
8-
org.jline:jline-terminal-jni: "3.30.5"
9-
org.slf4j:slf4j-api: "2.0.17"
10-
org.slf4j:slf4j-simple: "2.0.17"
1+
name: jpm
2+
description: A simple command line tool to manage Maven dependencies for Java projects
3+
that are not using build systems like Maven or Gradle
4+
documentation: |
5+
# jpm - Java Package Manager
6+
7+
A simple command line tool to manage Maven dependencies for Java projects that are not using build systems like Maven
8+
or Gradle.
119
10+
It takes inspiration from Node's npm but is more focused on managing dependencies and
11+
is _not_ a build tool. Keep using Maven and Gradle for that. This tool is ideal for those who want to compile and
12+
run Java code directly without making their lives difficult the moment they want to start using dependencies.
13+
authors:
14+
- Tako Schotanus (tako@codejive.org)
15+
contributors:
16+
- copilot
17+
links:
18+
homepage: https://github.com/codejive/java-jpm
19+
repository: https://github.com/codejive/java-jpm
20+
documentation: https://github.com/codejive/java-jpm/edit/main/README.md
21+
java: 11
22+
dependencies:
23+
eu.maveniverse.maven.mima:context: 2.4.33
24+
eu.maveniverse.maven.mima.runtime:standalone-static: 2.4.33
25+
org.apache.maven.indexer:search-backend-smo: 7.1.6
26+
info.picocli:picocli: 4.7.7
27+
org.yaml:snakeyaml: '2.4'
28+
org.jline:jline-console-ui: 3.30.5
29+
org.jline:jline-terminal-jni: 3.30.5
30+
org.slf4j:slf4j-api: 2.0.17
31+
org.slf4j:slf4j-simple: 2.0.17
1232
actions:
13-
clean: "./mvnw clean"
14-
build: "./mvnw spotless:apply package -DskipTests"
15-
run: "./target/binary/bin/jpm"
16-
test: "./mvnw test"
17-
buildj: "javac -cp {{deps}} -d classes --source-path src/main/java src/main/java/org/codejive/jpm/Main.java"
18-
runj: "java -cp classes:{{deps}} org.codejive.jpm.Main"
33+
clean: ./mvnw clean
34+
build: ./mvnw spotless:apply package -DskipTests
35+
run: ./target/binary/bin/jpm
36+
test: ./mvnw test
37+
buildj: javac -cp {{deps}} -d classes --source-path src/main/java src/main/java/org/codejive/jpm/Main.java
38+
runj: java -cp classes:{{deps}} org.codejive.jpm.Main

src/main/java/org/codejive/jpm/config/AppInfo.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,38 @@ public class AppInfo {
2727
/** The official name of the app.yml file. */
2828
public static final String APP_INFO_FILE = "app.yml";
2929

30+
public String name() {
31+
return (String) yaml.get("name");
32+
}
33+
34+
public String description() {
35+
return (String) yaml.get("description");
36+
}
37+
38+
public String documentation() {
39+
return (String) yaml.get("documentation");
40+
}
41+
42+
public String java() {
43+
return (String) yaml.get("java");
44+
}
45+
46+
@SuppressWarnings("unchecked")
47+
public List<String> authors() {
48+
if (yaml.get("authors") instanceof List) {
49+
return (List<String>) yaml.get("authors");
50+
}
51+
return null;
52+
}
53+
54+
@SuppressWarnings("unchecked")
55+
public List<String> contributors() {
56+
if (yaml.get("contributors") instanceof List) {
57+
return (List<String>) yaml.get("contributors");
58+
}
59+
return null;
60+
}
61+
3062
public List<String> dependencies() {
3163
return dependencies;
3264
}

0 commit comments

Comments
 (0)