Gradle build fails with cannot find symbol "org.jcp.xml.dsig.internal.dom.XMLDSigRI"

2.3k views Asked by At

I am using gradle to build my multi-module project. In one of my class, i have the following code segment.

private XMLSignatureFactory factory = XMLSignatureFactory.getInstance(
            "DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());

But when i build this project using gradle, the compilation is getting failed with the following error message.

error: package org.jcp.xml.dsig.internal.dom does not exist
private XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM", new org.jcp.xml.dsig.internal.dom.XMLDSigRI());

But i have already verified that the above class is from rt.jar of JRE. I have tried with JDK 7 and 8.

What may be the root cause of the above issue?

Regards, Mayuran

1

There are 1 answers

1
chaos On

I've encountered the same problem with you. And I solved by adding below configuration to build->maven-compiler-plugin.

<compilerArguments>
    <verbose />
    <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
</compilerArguments>

It seems like maven can't find rt.jar in higher jdk version(for me the version is 1.8), so we need to configure explicitly.

I hope this will help you.