Maven Project License Issue


#1

Dear team,
I Develop an Aspose Project in Maven, but i could’t add license file to the project
code
com.aspose.pdf.License license = new com.aspose.pdf.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));


#2

@rjnick

Thank you for contacting support.

Would you please elaborate the problem you are facing. Kindly share your narrowed down sample application including the POM file and other project configurations so that we may investigate further. Before sharing requested data, please ensure using Aspose.PDF for Java 19.9.


#3

@Farhan.Raza
file strut.JPG (11.6 KB)
pom.pdf (235.3 KB)
CODE

public class License {
static final String RESOURCEPATH = “/Aspose.Total.Java.lic”;
public static void main(String[] args) throws Exception {
AnsiConsole.systemInstall();
wordLicense();
pdfLicense();
cellslicense();
slideslicense();
diagramlicense();
notelicense();
imaginglicense();
tasklicense();
pagelicense();
htmllicense();
AnsiConsole.systemUninstall();
}
static void pdfLicense() throws Exception {
try {
com.aspose.pdf.License license = new com.aspose.pdf.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: PDF Licence”);
System.exit(0);
}
}

static void wordLicense() throws Exception {
try {
com.aspose.words.License license = new com.aspose.words.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: WORDS Licence”);
System.exit(0);
}
}
static void cellslicense() {
try {
com.aspose.cells.License license = new com.aspose.cells.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: CELLS Licence”);
System.exit(0);
}
}

static void slideslicense() {
try {
com.aspose.slides.License license = new com.aspose.slides.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: SLIDES Licence”);
System.exit(0);
}
}

static void diagramlicense() {
try {
com.aspose.diagram.License license = new com.aspose.diagram.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: DIAGRAM Licence”);
System.exit(0);
}
}

static void notelicense() {
try {
com.aspose.note.License license = new com.aspose.note.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: NOTE Licence”);
System.exit(0);
}
}

static void imaginglicense() {
try {
com.aspose.imaging.License license = new com.aspose.imaging.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: IMAGING Licence”);
System.exit(0);
}
}

static void tasklicense() {
try {
com.aspose.tasks.License license = new com.aspose.tasks.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: TASK Licence”);
System.exit(0);
}
}

static void pagelicense() {
try {
com.aspose.page.License license = new com.aspose.page.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: PAGE Licence”);
System.exit(0);
}
}

static void htmllicense() {
try {
com.aspose.html.License license = new com.aspose.html.License();
license.setLicense(License.class.getResourceAsStream("/Aspose.Total.Java.lic"));
} catch (Exception e) {
System.out.println("[" + ansi().fg(valueOf(“RED”)).a(“LICENSE ERROR”).reset() + “] :: HTML Licence”);
System.exit(0);
}
}

}

The Program Produces the output while executing in IDE , but the Licence is not appended after building the jar ,

error in jar.jpg (14.5 KB)
JAR BUILD OPTION.JPG (41.2 KB)


#4

@rjnick

Thank you for elaborating further.

Would you please also share the narrowed down sample application as ZIP so that we may proceed to reproduce it exactly, as per your project configurations.


#5

Dear @Farhan.Raza,
PFA- Sample Application
test.zip (10.6 KB)
Must Read.zip (345 Bytes)


#6

@rjnick

Thank you for the details.

We have logged a ticket with ID PDFJAVA-38910 in our issue management system and will let you know as soon as any further update will be available in this regard.