簡體   English   中英

使用 maven 編譯時如何使用 class 文件而不是 java 文件

[英]How to use class file instead of java file when compiling with maven

我們收到了更新的.class文件,但沒有收到項目的.java文件。 如何確保在編譯我們的maven pom時使用這個新的 class 文件,並將其放置在正確的目錄中而不影響項目?

提取 class 文件是非常不尋常的。 通常,您會得到一個 jar 並將其用作依賴項。 如果您有這樣的 class 文件,我會手動將它們捆綁到 jar 文件中,然后使用適當的坐標(groupId,artifactId, 然后,您可以在pom.xml它們作為依賴項引用。

Not sure if this is the best method, but i was able to accomplish using this class file as a replacement for.java and no.jar file being provided by adding this resource argument to the maven pom file.

<resource>
    <directory>${project.basedir}/src/main/java/com/action/helper</directory>
    <targetPath>${project.build.directory}/classes/com/action/helper</targetPath>
    <excludes>
        <exclude>**/*.java</exclude>
    </excludes>
</resource>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM