如何包括源文件(.java文件)并行到.class文件在生成的jar使用maven [英] How to include source file(.java file) parallel to .class file in the generated jar using maven

查看:205
本文介绍了如何包括源文件(.java文件)并行到.class文件在生成的jar使用maven的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用wars创建我的jars,其中应该包含源文件(.java文件)与生成的jar中使用maven的.class文件并行。 (我知道有一些插件可用于生成单独的xyy-sources.jar文件但我不想创建一个单独的源jar。我需要一个jar文件与.class和.java文件存在并行)

I wanted to create my jars with wars with that should include source file(.java file) parallel to .class file in the generated jar using maven. (I know there are some plugins available to generate a separate xyy-sources.jar file. But I dont want to create a seperate source jar. I need a single jar file with both .class and .java file exists parallel)

推荐答案

您只需在构建标记下添加资源。
例如。

You only have to add resources under build tag. For example.

<build>
   <resources>
      <resource>
        <directory>src/main/java</directory>
      </resource>     
    </resources>
</build>



现在你创建的每个jar和war文件都会包含.java文件。 :)

Now every jar and war file you creat would contain .java files also. :)

这篇关于如何包括源文件(.java文件)并行到.class文件在生成的jar使用maven的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆