0

我目前正在编写使用使用javax.smartcardiolib 的 Java 库(由我开发)的 Kotlin 代码,但在 Kotlin 编译时显示以下错误:

Cannot access class 'javax.smartcardio.CommandAPDU'. Check your module classpath for missing or conflicting dependencies

我能做些什么来解决这个问题?

谢谢你。

编辑:我正在使用 maven,我的依赖项和插件如下:

<properties>
    <kotlin.version>1.3.11</kotlin.version>
</properties>


<dependencies>
    <dependency>
        <groupId>io.javalin</groupId>
        <artifactId>javalin</artifactId>
        <version>2.4.0</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.25</version>
    </dependency>

    <!-- Kotlin -->
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib-jdk8</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-test</artifactId>
        <version>${kotlin.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>${kotlin.version}</version>
    </dependency>

    <dependency>
        <groupId>my.project</groupId>
        <artifactId>apdu-processor</artifactId>
        <version>0.1-SNAPSHOT</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <jvmTarget>1.8</jvmTarget>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>testCompile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

正在使用的库javax.smartcardioapdu-processor.

4

1 回答 1

1

由于javax.smartcardio不是您项目的直接依赖项,因此需要从apdu-processor. 在那里,您必须确保将此依赖项声明为COMPILE依赖项,而不是PROVIDEDRUNTIME

您始终可以通过在项目中明确声明 hte 依赖项来修复它。

于 2018-12-20T11:07:24.790 回答