Bug in Ignition SDK?

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