philipWendland / IsoApplet

A Java Card PKI Applet aiming to be ISO 7816 compliant
GNU General Public License v3.0
165 stars 72 forks source link

ant build failed #32

Closed ghost closed 10 months ago

ghost commented 11 months ago

Hello, I am trying to build the applet using the ant-javacard with the instruction provided in this repo readme but the build is failing. My system is:

philipWendland commented 11 months ago

Hello, I just tried in Arch Linux, it compiles fine. Are you sure that openjdk17 is used instead of a different version?

ghost commented 11 months ago

Hello, I just tried in Arch Linux, it compiles fine. Are you sure that openjdk17 is used instead of a different version?

Yes, I'm sure of it.

I also tried to build it in my windows machine where it has java 8 installed, and by using the same build.xml it produced the same error. Then I changed the javacard-jckit attribute in the xml to:

<javacard jckit="ext/sdks/jc304_kit">

and it built successfully.

Can you help me understand what is the usage between javacard-jckit attribute and cap-targetsdk attribute? So, in the provided build.xml, are you specifying to use higher (version) of jckit / sdk to then build the cap which target lower version of jckit/ sdk?. Thank you.

martinpaljak commented 11 months ago
diff --git a/build.xml b/build.xml
index 3f2d786..f395632 100644
--- a/build.xml
+++ b/build.xml
@@ -8,7 +8,7 @@
     <target name="dist" description="generate the distribution">
         <tstamp/>
         <javacard jckit="ext/sdks/jc310r20210706_kit">
-            <cap targetsdk="ext/sdks/jc304_kit" aid="f2:76:a2:88:bc:fb:a6:9d:34:f3:10" output="IsoApplet.cap" sources="src" version="1.0">
+            <cap targetsdk="3.0.4" aid="f2:76:a2:88:bc:fb:a6:9d:34:f3:10" output="IsoApplet.cap" sources="src" version="1.0">
                 <applet class="xyz.wendland.javacard.pki.isoapplet.IsoApplet" aid="f2:76:a2:88:bc:fb:a6:9d:34:f3:10:01"/>
             </cap>
         </javacard>

Set the targetsdk to "3.0.4". The reason why it probably work for you @philipWendland is that the ant-javacard.jar file is already present and older version. Clean checkout failed for me as well (other option would be to use a different javacard kit from 3.0.X series instead of 3.1)

@mario-jaya jckit identifies the javacard SDK which converter is used, targetsdk indicates the target platform for the applet. With JC devkit 3.1 new version of export files was introduced and that needs adjustments in workflows. See also https://github.com/martinpaljak/ant-javacard/issues/92

philipWendland commented 10 months ago

Thank you, I fixed this on the main branch.