check maven build error with custom jar files

1 year 7 months ago - 1 year 7 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.
<!--  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.

Please Log in or Create an account to join the conversation.

1 year 7 months ago #4627 by bbinder
Please check out my own response here .

Please Log in or Create an account to join the conversation.

Moderators: tmaebr
Time to create page: 0.038 seconds
^ Back to Top