markushedvall / node-plantuml

A Node.js module and CLI for running PlantUML
MIT License
189 stars 53 forks source link

PlantUML version upgrade? #34

Open lwalker-kforce opened 4 years ago

lwalker-kforce commented 4 years ago

Are there any plans to upgrade the PlantUML jar to a more current version? The latest is 1.2020.6...

tillig commented 4 years ago

There might be a workaround here where you can specify PLANTUML_HOME in the environment to point to your own JAR file.

I ran into this same issue and started digging, I'm going to try it.

tillig commented 4 years ago

I did get it working, but you also have to make sure you have vizjs.jar and the appropriate j2v8 jar file available as noted in the VizJS docs here. As a hack, I set up a folder called vendor and followed the pattern you see once you've installed the module. If you look in node_modules you see:

node_modules/
  node-plantuml/
    vendor/
      j2v8_macosx_x86_64-3.1.6.jar
      plantuml.jar
      vizjs.jar

The j2v8****.jar is installed based on your OS.

I created my own folder vendor outside of this, put the new plantuml.jar in there, and copied the other two files.

vendor/
  j2v8_macosx_x86_64-3.1.6.jar
  plantuml.jar # the new version
  vizjs.jar

Then I set my environment variable PLANTUML_HOME to point to .../vendor/plantuml.jar - the new location.

This seems to work. Without the other two JAR files you get errors about GraphViz missing. I gather I could add some paths to the environment to avoid copying the other two files, but in the end I found that the new version of PlantUML still doesn't really support a couple of the things that I think are in progress, so the upgrade doesn't help me. I didn't bother pursuing it further.

FarhadG commented 3 years ago

@tillig are you able to produce a PR for this fix so the community can leverage this broken upgrade?

tillig commented 3 years ago

Unfortunately it's been a long while since I had this working and my hack wasn't something I could push - as you noticed, I got it working by hacking environment variables and such, which isn't a PR-able thing. Since I didn't pursue it beyond the hack, I never actually got it fixed, and I've moved on to other things. I hate to sound selfish, but until I actually need to totally fix it for something I'm working on, I likely won't be back with a PR any time soon. Sorry.

FarhadG commented 3 years ago

Thanks for the quick response, @tillig! I totally get it and wasn't sure if the solution was in a state for PR. I'll see if I can prepare something for a PR as it would be nice to get this to work again

adrianvlupu commented 3 years ago

As a workaround, using it programmatically, I ended up with something like this, requiring the module after setting the process.env.PLANTUML_HOME

...
process.env.PLANTUML_HOME = path.join(__dirname, 'vendor', ver.jar);
const plantuml = require('node-plantuml');

plantuml
    .generate(path.join(item.dir, pumlFile), { format: options.DIAGRAM_FORMAT, charset: options.CHARSET })
    .out
    .pipe(stream);
...