Skip to content

An example to generate a java class from a pkl file #272

Answered by bioball
dev92 asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the pkl-tools fat jar, which includes all the dependencies needed for codgen.

Example:

printf "module Example\n\nfoo: String\n" > Example.pkl
curl -o pkl-tools-0.25.2.jar https://repo1.maven.org/maven2/org/pkl-lang/pkl-tools/0.25.2/pkl-tools-0.25.2.jar
java -cp pkl-tools-0.25.2.jar org.pkl.codegen.java.Main -o generated Example.pkl

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@dev92
Comment options

Comment options

You must be logged in to vote
1 reply
@dev92
Comment options

Answer selected by dev92
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants