AnsweredAssumed Answered

Deployment corrupts JAR file

Question asked by michaelp on Jul 4, 2014
First I dont know on which section this "question" belonges to but maybe any of you can help me.

On my maven project I just want to place a .jar file in /components/jnlp/my.jar but after the deployment into the WAR the file is 500 kB LARGER and also CORRUPTED and not useable anymore …

(I want the file to be accesable from a hyperlink e.g. http://localhost:8081/share/components/jnlp/my.jar, surprisingly this works with plain text files such as txt or html)

Why?

PS: I can replace the file with the original one after the deployment by hand and then it workes

EDIT: I am not the only one https://forums.alfresco.com/forum/developer-discussions/development-environment/alfresco-maven-111-sdk-plugin-corrupts-jar-file


SOLUTION:

Add the following to your pom.xml


<build>
   <pluginManagement>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.5</version>
            <configuration>
               <encoding>${project.build.sourceEncoding}</encoding>
               <nonFilteredFileExtensions>
                       <nonFilteredFileExtension>jar</nonFilteredFileExtension>
                       <nonFilteredFileExtension>pdf</nonFilteredFileExtension>
                       <nonFilteredFileExtension>swf</nonFilteredFileExtension>
                       <nonFilteredFileExtension>zip</nonFilteredFileExtension>
                       <nonFilteredFileExtension>bz2</nonFilteredFileExtension>
                       <nonFilteredFileExtension>gz</nonFilteredFileExtension>
                       <nonFilteredFileExtension>acp</nonFilteredFileExtension>
                       <nonFilteredFileExtension>bin</nonFilteredFileExtension>
                       <nonFilteredFileExtension>odt</nonFilteredFileExtension>
                       <nonFilteredFileExtension>doc</nonFilteredFileExtension>
                       <nonFilteredFileExtension>xls</nonFilteredFileExtension>
               </nonFilteredFileExtensions>
            </configuration>
         </plugin>
      </plugins>
   </pluginManagement>
</build>


Best regards,
Michael

Outcomes