Search code examples
typescriptvue.jsnpmdependenciespackage.json

Adding java project dependencies to npm project


I'm currently trying to add dependencies of a maven java project to my package.json in my vue/typescript project, so I can call certain data types. The project is under svn version control and lies on the nexus. How can I insert a dependecy to my vue-project? Also im trying to use java classes like java.util in my vue/typescript project. How can I do that?

Thanks for the help in advance.


Solution

  • While directly importing java classes to your typescript project is not possible, what you're trying to do can be partially achieved using typescript-generator.

    so I can call certain data types

    Typescript generator can generate typescript equivalent of your DTO classes saving you the trouble of synchronizing them between these two languages manually. Also, check out "REST frameworks" section if the documentation if you're using JAX-RS or Spring on the backend.

    Also im trying to use java classes like java.util in my vue/typescript project

    This part is not possible due to the reasons that @yoduh stated (they're two incompatible languages - one is running on the java virtual machine and the other is interpreted by the browser).