Add node js project as a dependency in a java project - java

I need to be able to add an existing Node js project as a maven dependency in a java project to be able to call functions from the node js project. I researched quiet a bit but am unable to find a way to do this.
I do not want to embed js in java, rather just import the libraries. Can anybody suggest a way ?

You could create a new Kotlin mutlti-platform project which takes a dependency on your node-js package. Then you could create a wrapper kotlin function which calls your node-js function. You can then use this Kotlin package as a dependency in your Java package. Here is more information regarding Kotlin multi-platform: https://kotlinlang.org/docs/multiplatform-library.html

Related

Maven uses class from wrong Library

i am currently working on a Maven project with alot external Libraries. Now i have following Issue...
Issue: I have two different Libraries(lets say Library A & Library B) and both have a class(lets name the class abc.class) with the same classname but the classes dont have the same Implementation! Now one of my testclasses uses abc.class from Library A, which is the wrong class/library. This testclass should use abc.class from Library B. I cant just delete the Library A because i needed also for other testclasses.
My SetUp:
Maven: apache-maven-3.6.1
Java: jdk11
IDE: IntelliJ
My Question: Is there a way to pin diffrent Libraries for specific classes? So i could pin the Library B to my failing testclass, so it can use the right Library and the right implementation for the abc.class.
In the best case, i would like to fix it in the POM :)
Pls let me know if its somehow possible.
No.
You need to have compatible versions of the class.
Or even better only include one type of Class to your build.

Why can't Xamarin import Spongy Castle?

I get tons of error regarding SpongyCastle's auto-generated .cs files after importing them, even though Xamarin generated them.
The Java library that I created needs the dependency, and I imported it into the Jars folder together with my Java library.
How to fix this?
If it is a Java library that is referenced by your Java library and you do not need to access it via C# user code, then you do not need to create a C# bindings for it.
Flag that .jar/.aar with a build type of:
EmbeddedReferenceJar : Use this to compile against and include it in your binding library.
or
ReferenceJar : Use this to compile against but not include it in your binding library. You will need to supply it in your final APK in another way.
Re: Build Actions

How to generate a Jar with only class definitions and methods using Maven?

I've got a project and want to share an API that can be used for building a plugin for my application.
Now I don't want to share the full source code but only class definitions and member declarations without their body.
I've seen dependencies before that without downloading the sources the IDE I'm using already knows the structure. That is what I'm going for.
A jar file already does most of what you want, as it does, if not obfuscated, contain all the class and method names in a format that will be understood by any Java IDE.
The rest can be done by preparing and delivering a javadoc jar.

How to generate Callable Wrapper(automatically) Xamarin Mono

I'm using an native lib for android via Java Bindings Library Project. All goes fine,except one method(and i don't understand why,maybe he's incorrect ported from java to C#).
So the main idea,to make an workaround via Callable Wrapper.
I have implemented Android project in native mode. In this project i also implemented java class(where i'm using this unlucky method) and what i need,just to know how to generate automatically Wrapper and how to add/use into my Mono project?
Or can i make an .jar lib on this native Android project and via bindings library add to my Xamarin.Android project?
PS Sorry for my eng.
Possible solution is to add new java class to OpenCV project. That class should contain methods you want to use ( e.g. to wrap FindContours()). Rebuild project and resulting JAR use in binding project in MonoDevelop/VS solution.
That way you'll call wrapped FindContours() method and it will return expected results :) .

How do you get gradle to access a string from a Java class in the project in my build.gradle?

I'm fairly new to Gradle so excuse my ignorance: I have a class that has a static string containing the build version I want to set for the project. With gradle, I can't seem to access the project directly with just MyClass.MyVersionString.
What would be the easiest way to go about it? I can't seem to find a simple way of doing this.
Alternatively, if there was a way to access the Gradle version from my project, that too would help. The project needs access to the version, so I'd like a way to set it in one place and have everything else automagically update.
Thanks!
If building an Android project, you can do it the other way: use BuildConfig.VERSION_NAME (or BuildConfig.VERSION_CODE), depending on what you need.
The BuildConfig class is automatically generated from the information in the AndroidManifest (and some other places, such as the flavor you're building).

Categories