Wednesday, July 31, 2019

Adding Github Repository as a Dependecy to Java Project

I just learned that we could easily add a Github repository as a dependency to a Java project using JitPack. Below is an example to a Maven project to which we wish to add JGraphX as a dependency to the Maven project. Since JGraphX "don't properly support Maven or publish to Maven Central", this comes very handy. I view this as a two step approach:

  1. Add JitPack to the pom.xml. I added the following just above the dependencies tag:
    
    <repositories>
     <repository>
      <id>jitpack.io</id>
      <url>https://jitpack.io</url>
     </repository>
    </repositories>
    
  2. Add a Git commit or release of a Git repository as a dependency. In the following, we use the JGraphX project as an example. The project's Git repository is the JGraphX repository whose url is https://github.com/jgraph/jgraphx.git, from which we read that the Github username is jgraph, and the repository name is jgraphx. Browsing the project repository, we can select a commit by using its commit id (i.e., commit hash), or a tag, or a release. The JGraphX has a number releases as seen at https://github.com/jgraph/jgraphx/releases, among which is v4.0.3. Having gathered the Github username, the repository name, and the release number, we add the following as a child tag to the dependencies tag,
    
     <dependency>
      <groupId>com.github.jgraph</groupId>
      <artifactId>jgraphx</artifactId>
      <version>v4.0.3</version>
     </dependency>
    
After these two steps, we do a Maven update.

Friday, July 12, 2019

Looking up TexLive Package Name using .sty Filename

I am using TexLive, and sometimes it reports that it cannot locate a .sty file. It is not always the case that the package name is identical to the .sty filename (less the extension). For instance, when LaTeX reports that it cannot locate manyfoot.sty. The following will fail because the package that has manyfoot.sty isn't manyfoot.

$ tlmgr install manyfoot
tlmgr.pl: package repository http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
tlmgr.pl install: package manyfoot not present in repository.
tlmgr.pl: action install returned an error; continuing.
tlmgr.pl: An error has occurred. See above messages. Exiting.

A method to figure out the package name is to use tlmgr to search TexLive repositories, i.e.,

tlmgr search --global --file STY_FILE_NAME

For the example of manyfoot.sty, we do,

$ tlmgr search --global --file  manyfoot.sty
tlmgr.pl: package repository http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
lwarp:
        texmf-dist/tex/latex/lwarp/lwarp-manyfoot.sty
ncctools:
        texmf-dist/tex/latex/ncctools/manyfoot.sty

after which we do,

$ tlmgr install ncctools
tlmgr.pl: package repository http://ctan.math.utah.edu/ctan/tex-archive/systems/texlive/tlnet (not verified: gpg unavailable)
[1/1, ??:??/??:??] install: ncctools [2430k]
running mktexlsr ...
done running mktexlsr.
tlmgr.pl: package log updated: C:/Applications/texlive/2019/texmf-var/web2c/tlmgr.log