Ignition Maven Plugin Not Copying Dependencies

I'm trying to build a quick module with Apache Spark to play around with a couple things. Whenever I build the module I'm getting the following bug from maven.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.inductiveautomation.ignitionsdk:ignition-maven-plugin:1.0.8:modl (default) on project ignition-spark-build
: Error copying dependency artifacts.
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying dependency artifacts.
        at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.copyArtifacts(IgnitionModlMojo.java:228)
        at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.execute(IgnitionModlMojo.java:183)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: java.nio.file.FileAlreadyExistsException: C:\Users\codyt\AppData\Local\Temp\modl3795338092209120782\avro-ipc-1.7.7.jar
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:81)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
        at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
        at java.nio.file.Files.newOutputStream(Files.java:216)
        at java.nio.file.Files.copy(Files.java:3016)
        at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.copyArtifacts(IgnitionModlMojo.java:203)
        ... 23 more

I've got the following dependencies in my gateway pom.xml.

    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>2.2.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-mllib_2.11</artifactId>
        <version>2.2.0</version>
        <scope>provided</scope>
    </dependency>

Is there a way to work around this?

Does that location change every time you build? Can you just delete that file?

The location does seem to change, and I have deleted that file.

This morning I woke up with a clear head and added a “provided” scope on that first dependency and it worked. So it’s definitely my problem.

Are those really supposed to be “provided” scope though? How do they end up on the classpath?

That’s an excellent question… I was using https://mvnrepository.com/artifact/org.apache.spark and blindly copying the dependencies into my project. After looking through them, some have a “provided” scope and some don’t mention it at all. To be honest, I still don’t understand maven that well

I’ll do some testing/debugging on the project and see if I notice that anything is missing in run-time.

Yeah ok I’m getting ClassNotFound exceptions everywhere so I probably need that to be scoped under “compile”. Any suggestions?

I’m having the exact same issue but in my case with the deeplearning4j library. Did you find a solution to this problem?

Regards

Hi,

I am also facing the same issue trying to add dependencies for Microsoft Graph API.

I modified the scripting-function ignition-sdk example.

Added the following dependencies in the pom.xml under scripting-function-common:

<dependency>
    <groupId>com.microsoft.graph</groupId>
    <artifactId>microsoft-graph</artifactId>
    <version>[5.0,)</version>
</dependency>
<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-identity</artifactId>
    <version>[1.3,)</version>
</dependency>

Running mvn -e package:

...
[INFO] --- ignition-maven-plugin:1.1.0:modl (package-modl) @ scripting-function-build ---
[INFO] project=scripting-function-build, ignitionScope=null
[INFO] project=scripting-function-client, ignitionScope=C
[INFO] building client scoped artifact set...
[INFO] project=scripting-function-common, ignitionScope=CDG
[INFO] building client scoped artifact set...
[INFO] building designer scoped artifact set...
[INFO] building gateway scoped artifact set...
[INFO] project=scripting-function-designer, ignitionScope=CD
[INFO] building client scoped artifact set...
[INFO] building designer scoped artifact set...
[INFO] project=scripting-function-gateway, ignitionScope=G
[INFO] building gateway scoped artifact set...
[INFO] Using temp dir: /tmp/modl1830851746944310507
[INFO] copying g artifacts
[INFO] copying dependency artifact: netty-codec-socks-4.1.100.Final.jar
[INFO] copying dependency artifact: content-type-2.2.jar
[INFO] copying dependency artifact: netty-tcnative-boringssl-static-2.0.62.Final.jar
[INFO] copying dependency artifact: msal4j-1.14.0.jar
[INFO] copying dependency artifact: jackson-databind-2.13.5.jar
[INFO] copying dependency artifact: netty-handler-proxy-4.1.100.Final.jar
[INFO] copying dependency artifact: reactor-netty-http-1.0.38.jar
[INFO] copying dependency artifact: nimbus-jose-jwt-9.30.2.jar
[INFO] copying dependency artifact: netty-resolver-dns-4.1.100.Final.jar
[INFO] copying dependency artifact: netty-resolver-dns-native-macos-4.1.100.Final.jar
[INFO] copying dependency artifact: netty-tcnative-boringssl-static-2.0.62.Final.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for scripting-function 1.0.0-SNAPSHOT:
[INFO]
[INFO] scripting-function ................................. SUCCESS [  0.002 s]
[INFO] scripting-function-common .......................... SUCCESS [ 10.184 s]
[INFO] scripting-function-client .......................... SUCCESS [  5.304 s]
[INFO] scripting-function-designer ........................ SUCCESS [  0.369 s]
[INFO] scripting-function-gateway ......................... SUCCESS [  2.685 s]
[INFO] scripting-function-build ........................... FAILURE [  0.131 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.765 s
[INFO] Finished at: 2023-11-13T15:26:40+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.inductiveautomation.ignitionsdk:ignition-maven-plugin:1.1.0:modl (package-modl) on project scripting-function-build: Error copying dependency artifacts.: /tmp/modl1830851746944310507/netty-tcnative-boringssl-static-2.0.62.Final.jar -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.inductiveautomation.ignitionsdk:ignition-maven-plugin:1.1.0:modl (package-modl) on project scripting-function-build: Error copying dependency artifacts.
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying dependency artifacts.
    at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.copyArtifacts (IgnitionModlMojo.java:260)
    at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.execute (IgnitionModlMojo.java:219)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.nio.file.FileAlreadyExistsException: /tmp/modl1830851746944310507/netty-tcnative-boringssl-static-2.0.62.Final.jar
    at sun.nio.fs.UnixException.translateToIOException (UnixException.java:94)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:111)
    at sun.nio.fs.UnixException.rethrowAsIOException (UnixException.java:116)
    at sun.nio.fs.UnixFileSystemProvider.newByteChannel (UnixFileSystemProvider.java:219)
    at java.nio.file.spi.FileSystemProvider.newOutputStream (FileSystemProvider.java:478)
    at java.nio.file.Files.newOutputStream (Files.java:220)
    at java.nio.file.Files.copy (Files.java:3067)
    at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.copyArtifacts (IgnitionModlMojo.java:239)
    at com.inductiveautomation.ignitionsdk.IgnitionModlMojo.execute (IgnitionModlMojo.java:219)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:298)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :scripting-function-build

Has anyone found an explanation for this error?

Thanks

Looks like an SSL clash from two different sources. (I don't use maven, so just guessing.)

So if I understand correctly, the added dependencies conflicts with Ignition dependencies, right?

You say you don't use maven, could the build system be the cause?

The (open source) Maven module plugin we provide but no longer use internally appears to be trying to put a dependency into the same location some other aspect of the build system is, based on the stacktrace.

The implementation logic of the copyArtifacts step is here:

Like I said, we don't use Maven anymore internally. We use Gradle and our (also open source) Gradle module plugin, which is much more thoroughly tested than this Maven plugin. You're welcome to fork it, not use it, switch your build system to Gradle, whatever you want.

2 Likes

I see! Thank you for the explanation, I will look into it.

1 Like

I actually ended up changing a few things in the maven plugin about 1-2 years ago that fixed a similar issue I had. If you want to try upgrading the maven plugin to 1.2.0 in your build pom.xml that might fix that for you.

2 Likes

I tried version 1.2.0 but it still didn't work.

I ended up forking the plugin and adding the file existence check for gateway artifacts in copyArtifacts method:

The build works now.

Thank you for your help!

3 Likes