Free Support Forum - groupdocs.com

Java samples do not work because of POM dependency


#1
I am using Linux (Ubuntu), Maven 3.1.1, Oracle Java 1.7.0_51.

I have downloaded the GroupDocs.Viewer from:

http://groupdocs.com/Community/getting-started/java/document-viewer-java-library.aspx

I've installed it in my local Maven repository as explained here:

http://groupdocs.com/docs/display/viewerjava/GroupDocs.Viewer+for+Java+-+Installation

I then downloaded the samples from:

http://groupdocs.com/Community/files/9/java-libraries/groupdocs_viewer_for_java/category1004.aspx

The Spring sample does not start, and I see the following error:

[WARNING] The POM for com.aspose:aspose-cells:jar:8.2.1 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-email:jar:4.5.0.0 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-imaging:jar:2.1.0.0 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-pdf:jar:9.5.1 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-slides:jar:14.6.1 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-words:jar:14.8.0 is missing, no dependency information available
[WARNING] The POM for com.aspose:aspose-diagram:jar:2.3.0 is missing, no dependency information available
[WARNING] The POM for com.ice.jni:registry:jar:3.1.3 is missing, no dependency information available
..
[ERROR] Failed to execute goal on project groupdocs-viewer-spring: Could not resolve dependencies for project com.groupdocs.samples:groupdocs-viewer-spring:war:2.5.0: The following artifacts could not be resolved: com.aspose:aspose-cells:jar:8.2.1, com.aspose:aspose-email:jar:4.5.0.0, com.aspose:aspose-imaging:jar:2.1.0.0, com.aspose:aspose-pdf:jar:9.5.1, com.aspose:aspose-slides:jar:14.6.1, com.aspose:aspose-words:jar:14.8.0, com.aspose:aspose-diagram:jar:2.3.0, com.ice.jni:registry:jar:3.1.3: Failure to find com.aspose:aspose-cells:jar:8.2.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

When I look in the .pom file of the viewer (in ~/.m2/repository/com/groupdocs/groupdocs-viewer/2.5.0/groupdocs-viewer-2.5.0.pom), I see:

com.aspose
aspose-cells
8.2.1
com.aspose
aspose-email
4.5.0.0
com.aspose
aspose-imaging
2.1.0.0
com.aspose
aspose-pdf
9.5.1
com.aspose
aspose-slides
14.6.1
com.aspose
aspose-words
14.8.0
com.aspose
aspose-diagram
2.3.0
com.ice.jni
registry
3.1.3

However, these dependencies seem to have been bundled into the .jar file.

When I remove these dependencies, the samples work as expected.

I recommend that these dependencies should be removed from the viewer's .jar file.

#2
Hello Dijk, thank you for interest in GroupDocs.

Sorry to see you are facing this problem. It is strange but we cannot reproduce this situation. It can only be possible with the slim version, but it’s available only in the Maven central repository, not on the page you pointed to. Are you sure you used the install:install-file Maven command?

Also, when did you download the library? Can you try to redownload the library and reinstall it (make sure to use install:install-file)?

Dependencies you mentioned are listed only in the GroupDocs.Viewer for Java slim version, because it does not embed those libraries as opposite to the full GroupDocs.Viewer for Java library available on the GroupDocs website.


#3
Here is the exact command I used:

mvn install:install-file -Dpackaging=jar -Dversion=2.5.0 -DgroupId=com.groupdocs -DartifactId=groupdocs-viewer -Dfile=GroupDocs.Viewer.jar

I downloaded the file yesterday, from the page that I linked in my original post. The timestamp of my file is 08:48 (CET), apparently that is when I downloaded it. Size: 79575235 bytes. MD5 checksum: 0b24de5846285a21dc6cfc61fb5ed0fc.

How do I identify the 'slim' version of the viewer? (My downloaded file is called "GroupDocs.Viewer_2.5.0_java.zip").

I'll download the file again and reinstall it.


#4

Removing all com.groupdocs artifacts from my Maven repository and reinstalling the JAR solved the issue, thanks!


I could also reproduce the error: Before installing the JAR file, what I tried first was running one of the sample applications (from the GroupDocs.Viewer_2.5.0_java_samples.zip file). Starting the sample failed, but it apparently installed a different version of the viewer into my Maven repository, with those dependencies.


#5

Hello Dijk, thank you for clarifying the situation.


Yes, you should first remove previous artifact installation from the Maven local repository. Maven has strange ability to cache meta-data and preventing from correct run even after reinstall.

As I’ve mentioned we deploy the slim version of the GroupDocs.Viewer for Java library to the Maven central. So it was downloaded as missing dependency when you started one of samples.

Nice to see that everything works fine now!