I have a maven project in which the some xlsx files get generated after the project run phase. These excel sheets are used by some other projects also. So I need to publish these excel sheet artifacts to remote|local repository.
I tried with the deploy plugin’s deploy-file goal. But after deploying the excel sheet as a jar in repo, I tried extracting the jar and I could see the excel sheet got corrupted. Excel sheet converted to several XML files. ( Sheet1.xml, Sheet2.xml ..)
Maven command :-
mvn clean deploy:deploy-file -Durl=file:///C:\repository -Dfile=Series.xlsx -DpomFile=seriesXL.pom
SeriesXL.pom:-
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.test.pjt</groupId>
<artifactId>seriesXL</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<includes>
<include>*.xlsx</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.6</version>
</dependency>
</dependencies>
</project>
Please help me to resolve this issue. All inputs are appreciated.
Microsoft is trying to push new file formats that are using ZIP and XML in their office suites. This method reduces the size of the file by around 50%.
Reference
That means the excel file is actually a packed file of different xmls and other metadata informations.
I have done a work around to resolve the issue:
After excel sheet generation, I have added that file to a zip (SeriesXL.zip), using
java.util.zip.ZipEntry.Then deploy the zip file using the command
I am able to successfully deploy the SeriesXL.jar in local repository and while extracting the jar, I could see the original version of the Excel sheet, not just a bundle of XML files.
BTW Thanks Dunni for your support.