开发者

Maven create jar file with both .class and .java files

开发者 https://www.devze.com 2023-01-26 10:09 出处:网络
I\'m looking for a way to create jar files containing both .class and .java files for GWT module开发者_如何学Cs. Anyone knows how that could be achieved?Edit your resources section in your pom.xml.

I'm looking for a way to create jar files containing both .class and .java files for GWT module开发者_如何学Cs. Anyone knows how that could be achieved?


Edit your resources section in your pom.xml.

<build>
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
    <resource>
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.java</include>
        <include>**/*.gwt.xml</include>
      </includes>
    </resource>
  </resources>
  ...
</build>

You can also edit the maven-jar-plugin to exclude them from the final JAR.

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
      <!-- but be sure to exclude the source from the final jar file -->
      <excludes>
        <exclude>**/*.java</exclude>
        <exclude>**/*.gwt.xml</exclude>
      </excludes>
    </configuration>
</plugin>


Use the resource tag in pom.xml to include src/main/java.

0

精彩评论

暂无评论...
验证码 换一张
取 消