Home > Back-end >  Compile java to .jar file dependency
Compile java to .jar file dependency

Time:12-08

Ive found an opensource java application that i want to use to generate a document however i know very little about java and even less about maven.

The project is Stencil Template Engine

My plan is to include the above as a dependency in a spring boot mvc application so i can use the Java API to render a document, however my issues are:

  • The above project is not listed a maven so i cant import it.
  • i can see a number of .java files nested into subfolders which im assuming i need to compile to a .class file. Attempts have failed
  • Ive added the dependency to the pom.xml file as instructed in the readme but it errors because it cant find the jar file
  • I cant find a way to import maven dependencies listed in the pom file
  • javac commands have all failed

Could someone please recommend a way of cloning and building the above into a jar file,

CodePudding user response:

Below is the text from README file of the github link you have.

Try to add both maven repository and maven dependency in your pom.xml

For example add this in your existing pom xml:

<repositories>
    <repository>
        <id>clojars.org</id>
        <url>https://repo.clojars.org</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>io.github.erdos</groupId>
        <artifactId>stencil-core</artifactId>
        <version>0.3.29</version>
    </dependency>
</dependencies>

From README file

Latest stable version is 0.3.29

Latest snapshot version is 0.3.30-SNAPSHOT

If you are using Maven, add the followings to your pom.xml:

The dependency:

<dependency>
  <groupId>io.github.erdos</groupId>
  <artifactId>stencil-core</artifactId>
  <version>0.3.29</version>
</dependency>

And the Clojars repository:

<repository>
  <id>clojars.org</id>
  <url>https://repo.clojars.org</url>
</repository>

Alternatively, if you are using Leiningen, add the following to the :dependencies section of your project.clj file: [io.github.erdos/stencil-core "0.3.29"]

Previous versions are available on the Stencil Clojars page.

  • Related