You need to have an include filter on your source set (inside cpp { source { /* here */ } }. Right now, we don’t apply any sort of default filtering, so the compiler is trying to parse the .lib files as C++ source files.
:compileMainSharedLibraryMainCpp
In file included from /applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:6:
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:15:17: error: jni.h: No such file or directory
In file included from /applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:6:
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:19: error: ‘jfieldID’ does not name a type
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: ‘JNIEnv’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: ‘env’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: ‘jobject’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: ‘jfieldID’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: expected primary-expression before ‘const’
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:28: error: variable or field ‘convertException’ declared void
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:28: error: ‘JNIEnv’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:28: error: ‘env’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:28: error: expected primary-expression before ‘const’
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:11: error: ‘jfieldID’ does not name a type
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: redefinition of ‘std::string getStrField’
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.hpp:24: error: ‘std::string getStrField’ previously declared here
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: ‘JNIEnv’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: ‘env’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: ‘jobject’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: ‘jfieldID’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:26: error: expected primary-expression before ‘const’
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:43: error: variable or field ‘convertException’ declared void
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:43: error: ‘JNIEnv’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:43: error: ‘env’ was not declared in this scope
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/JniSupport.cpp:43: error: expected primary-expression before ‘const’
:compileMainSharedLibraryMainCpp FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ‘:compileMainSharedLibraryMainCpp’.
C++ compiler failed; see the error output for details.
Basically I am changing the POM file to gradle.Below is the POM file
What went wrong:
A problem occurred configuring root project ‘NativeJNI’.
Exception thrown while executing model rule: model.components
Cannot create a PrebuiltLibraries because this type is not known to this container. Known types are: NativePlatform, Platform
You’re getting a lot of things mixed together there…
You want components, repositories and platforms to be top-level blocks inside model {} It looks like you’re putting everything inside components right now.
Your braces are very wrong. They need to enclose the block like a Java method would. It might make it a little easier to see if you put all of the top-level pieces in their own separate model {} block.
But while I run this code it throws an error
:compileMainSharedLibraryMainCpp
/applications/jenkins/workspace/NativeJNI/NativeJNI/src/main/c++/native/DiseaseStagingJni.cpp:42:38: error: DiseaseStagingJniWrapper.h: No such file or directory
:compileMainSharedLibraryMainCpp FAILED
beacuse DiseaseStagingJni.cpp file mentioned the name of DiseaseStagingJniWrapper.h file as #include DiseaseStagingJniWrapper.h
and this file is not avilable in the source code it looks me the last part of the POM file is doing it all
which is having the dependency on common module and then use the class.if I commented this file in the source code where it is mentioned then the build completed succesfully with one error
I am using the linker option as welll where it is throwing an error I took the same option which is in POM file
Could you please help me how could I fix this I mean use the Common module as dependency and the use it’s class for generated resources as they are doing it in POM file
Do I need to use java plugin to fetch the Common module from my binary repository(Artifactory)and then use it.