- Posts: 6
- Thank you received: 0
×
Modelio 4.0.0 released (07 Nov 2019)
Modelio 4.0.0 has been released ( www.modelio.org/forum/4-announcements/45...-4-0-0-released.html )
maven build error with custom jar files
4 years 10 months ago - 4 years 9 months ago #4619 by bbinder
Hello everybody,
I am building a Modelio Plugin and am encountering a problem during the build which i cannot fix. I have some C# code which I have bridged to Java using jni4net. Basically, this outputs two jar-files and four dlls. With the standard maven archetype, i can build this project just fine. But when i try to instantiate the classes exposed by the jar-files in Modelio itself (after adding the module), i get a ClassDefNotFound exception.
Then i checked out the jmdac and realized the jars and dlls were not added to the /lib folder. I extended the assembly.xml file to package those files alongside commons-lang3-3.1.jar in the lib folder.
A quick build shows correct packaging. Still, i thought i have to add those files to the ClassPath in the module.xml. First, I added the jni4net standard jar:
It still builds without a problem. However, when i add the other jar, it suddenly doesn't build anymore:
and mvn install -X will throw an Exception and show the following error:
This seems to happen because during build, the jar-files and the dlls cannot be associated. But i am stuck as to when exactly and where exactly the module configureation goal searches for the files. maybe i have to copy them to the correct location?
Any help would be appreciated.
I am building a Modelio Plugin and am encountering a problem during the build which i cannot fix. I have some C# code which I have bridged to Java using jni4net. Basically, this outputs two jar-files and four dlls. With the standard maven archetype, i can build this project just fine. But when i try to instantiate the classes exposed by the jar-files in Modelio itself (after adding the module), i get a ClassDefNotFound exception.
Then i checked out the jmdac and realized the jars and dlls were not added to the /lib folder. I extended the assembly.xml file to package those files alongside commons-lang3-3.1.jar in the lib folder.
<!-- Copy the jni4net dependencies -->
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>${project.name}/lib</outputDirectory>
<includes>
<include>*.jar</include>
<include>*.dll</include>
</includes>
</fileSet>
A quick build shows correct packaging. Still, i thought i have to add those files to the ClassPath in the module.xml. First, I added the jni4net standard jar:
<ClassPath>
<PathEntry path="lib/${project.artifactId}-${project.version}.jar"/>
<PathEntry path="lib/jni4net.j-0.8.8.0.jar"/>
<PathEntry path="lib/commons-lang3-3.1.jar"/>
</ClassPath>
It still builds without a problem. However, when i add the other jar, it suddenly doesn't build anymore:
<ClassPath>
<PathEntry path="lib/${project.artifactId}-${project.version}.jar"/>
<PathEntry path="lib/jni4net.j-0.8.8.0.jar"/>
<PathEntry path="lib/commons-lang3-3.1.jar"/>
<PathEntry path="lib/SysMLDataModel.j4n.jar"/>
</ClassPath>
and mvn install -X will throw an Exception and show the following error:
[INFO] Updating content of [...]\src\main\conf\module.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.715 s
[INFO] Finished at: 2017-09-04T10:38:12+02:00
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.modelio:modelio-maven-plugin:3.6.1.00:module-configuration (ResourceManagement) on project [TEST]: Execution ResourceManagement of goal org.modelio:modelio-maven-plugin:3.6.1.00:module-configuration failed: String index out of range: -1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.modelio:modelio-maven-plugin:3.6.1.00:module-configuration (ResourceManagement) on project [TEST]: Execution ResourceManagement of goal org.modelio:modelio-maven-plugin:3.6.1.00:module-configuration failed: String index out of range: -1
This seems to happen because during build, the jar-files and the dlls cannot be associated. But i am stuck as to when exactly and where exactly the module configureation goal searches for the files. maybe i have to copy them to the correct location?
Any help would be appreciated.
Last Edit: 4 years 9 months ago by bbinder.
Please Log in or Create an account to join the conversation.
4 years 9 months ago #4627 by bbinder
Please check out my own response
here
.
Please Log in or Create an account to join the conversation.
Moderators: tma
Time to create page: 0.035 seconds