hendriks73 / ffsampledsp

FFmpeg based service provider for javax.sound.sampled.
GNU Lesser General Public License v2.1
24 stars 5 forks source link

Failed to execute goal shade on project: Error creating shaded jar: error in opening zip file ffmpeg-4.0.0-sources.tar.bz2 #8

Closed aeris170 closed 3 years ago

aeris170 commented 3 years ago

Maven shade plugin errs using this dependency:

<dependency>
   <groupId>com.tagtraum</groupId>
   <artifactId>ffsampledsp-complete</artifactId>
   <version>0.9.32</version>
</dependency>

Here is my shade plugin:

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-shade-plugin</artifactId>
   <version>3.2.4</version>
   <executions>
      <execution>
         <phase>package</phase>
         <goals>
            <goal>shade</goal>
         </goals>
      </execution>
   </executions>
</plugin>

Going to the folder in the error, I see the "sources" archive. Capture

Maven can't open the file for some reason. Any advice?


Here is the full error:

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 27.795 s (Wall Clock) [INFO] Finished at: 2021-03-19T09:41:26+03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project DoaEngine: Error creating shaded jar: error in opening zip file C:\Users\Doga.m2\repository\com\tagtraum\ffmpeg\4.0.0\ffmpeg-4.0.0-sources.tar.bz2 -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [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

and here is my full pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>doa</groupId>
    <artifactId>DoaEngine</artifactId>
    <packaging>jar</packaging>
    <version>3.0</version>
    <name>DoaEngine</name>
    <description>A simple 2D game development framework for Java Developers.</description>
    <issueManagement>
        <url>https://github.com/aeris170/DoaEngine/issues</url>
    </issueManagement>
    <developers>
        <developer>
            <id>aeris170</id>
            <name>Doğa Oruç</name>
            <email>aeris170@gmail.com</email>
            <url>https://aeris170.github.io</url>
        </developer>
    </developers>
    <licenses>
        <license>
            <name>GNU AGPLv3</name>
            <url>https://choosealicense.com/licenses/agpl-3.0/</url>
        </license>
    </licenses>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <compilerArgs>
                        --enable-preview
                    </compilerArgs>
                    <source>15</source>
                    <target>15</target>
                    <release>15</release>
                    <encoding>UTF-8</encoding>
                    <excludes>
                        <exclude>doa/main/**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <excludes>
                        <exclude>doa/main/**</exclude>
                        <exclude>TOFFEE.otf</exclude>
                        <exclude>1.gif</exclude>
                        <exclude>2.gif</exclude>
                    </excludes>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <version>3.2.0</version>
                <configuration>
                    <source>14</source>
                    <additionalOptions>--enable-preview</additionalOptions>
                    <windowtitle>${project.name} ${project.version} API Documentation</windowtitle>
                    <doctitle>${project.name} ${project.version} API Documentation</doctitle>
                    <overview>${basedir}/overview.html</overview>
                    <stylesheetfile>${basedir}/stylesheet.css</stylesheetfile>
                    <show>protected</show>
                    <excludePackageNames>doa.main</excludePackageNames>
                    <failOnError>false</failOnError>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    <organization>
        <url>aeris170.github.io</url>
    </organization>
    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>jcenter</id>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>28.2-jre</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.javatuples/javatuples -->
        <dependency>
            <groupId>org.javatuples</groupId>
            <artifactId>javatuples</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jbox2d/jbox2d -->
        <dependency>
            <groupId>org.jbox2d</groupId>
            <artifactId>jbox2d</artifactId>
            <version>2.2.1.1</version>
            <type>pom</type>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.jbox2d/jbox2d-library -->
        <dependency>
            <groupId>org.jbox2d</groupId>
            <artifactId>jbox2d-library</artifactId>
            <version>2.2.1.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.code-disaster.steamworks4j/steamworks4j -->
        <dependency>
            <groupId>com.code-disaster.steamworks4j</groupId>
            <artifactId>steamworks4j</artifactId>
            <version>1.8.0</version>
        </dependency>
        <!-- https://github.com/geo-gs/WaifUPnP/ -->
        <dependency>
            <groupId>com.github.geo-gs</groupId>
            <artifactId>WaifUPnP</artifactId>
            <version>master</version>
        </dependency>
        <!-- https://github.com/JnCrMx/discord-game-sdk4j -->
        <dependency>
            <groupId>com.github.JnCrMx</groupId>
            <artifactId>discord-game-sdk4j</artifactId>
            <version>0.3</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.tagtraum/ffsampledsp-complete -->
        <dependency>
            <groupId>com.tagtraum</groupId>
            <artifactId>ffsampledsp-complete</artifactId>
            <version>0.9.32</version>
        </dependency>
    </dependencies>
</project>
hendriks73 commented 3 years ago

The easiest solution to this may be to exclude the dependency to the tagtraum FFmpeg source package, because it is not needed at runtime.

I.e. use

<dependency>
    <groupId>com.tagtraum</groupId>
    <artifactId>ffsampledsp-complete</artifactId>
    <version>0.9.32</version>
    <exclusions>
        <exclusion>
            <groupId>com.tagtraum</groupId>
            <artifactId>ffmpeg</artifactId>
        </exclusion>
    </exclusions>
</dependency>

The reason why the FFmpeg sources are packaged as a dependency is a legal one. LGPL requires you to make the modified/original sources available. But in your own project you should be able to package it any which way you like, so this is up to you.

Note that I haven't actually tried this, but I hope it helps.

aeris170 commented 3 years ago

Thank you for the reply, the build succeeds with the exclusions. Closing as solved.