java2typescript icon indicating copy to clipboard operation
java2typescript copied to clipboard

Generate from downloaded sources (no java project)

Open fplini opened this issue 8 years ago • 1 comments

Hi all! I have an angular 2 project (builded using maven) and on generate-sources I download some java files from another module. I want to generate TS from these java files saved into "target/be-sources" directory. Could I configure the plugin to set the dir input files instead of specific class/package? An example of what I want to do is to set the input sources like this <serviceClass>/target/be-sources/**/*Controller.java</serviceClass>

Thanks!

fplini avatar Feb 02 '17 10:02 fplini

Hi @fplini, (I'm maintaining java2typescript-jackson subproject, so I'm not so familiar with maven plugin, but I'll try to answer). To be honest, java2typescript-maven-plugin hasn't been maintained since @raphaeljolivet got the initial implementation working (2013.12.30), but the features used by the maven plugin are standalone subprojects (java2typescript-jackson and java2typescript-jaxrs) so it might not matter much if You are willing to dig into the maven plugin code.

Regarding Your specific question - I'm not sure I understood it well enough to answer... Did I understand You correctly, that

I download some java files from another module

You are really download java source files, not compiled java classes? If so, You'll need to compile them before trying to generate typescript out of it. Also the class You feed into the maven plugin, needs to be on the runtime classpath of the plugin.

I want to generate TS from these java files saved into "target/be-sources" directory

That seems to be possible with tsOutFolder plugin parameter (also found in the plugin documentation)

Could I configure the plugin to set the dir input files instead of specific class/package?

Probably You'd need another build step (or extra plugin - I'm not very familiar with mvn ecosystem) to compile the sources before java2typescript-maven-plugin does its work, as the plugin works on the compiled java classes, not directly on sources.

atsu85 avatar Feb 02 '17 20:02 atsu85