Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
502 views
in Technique[技术] by (71.8m points)

java - Making maven copy additional files inside the build jar (not resources but any file inside any package)?

I have a package org.myapp.mypackage with some ruby files (*.rb) and I need to include them in the generated build jar in the same package along with the java class files.

How do I tell my friend Maven to do this?

Note : No, I cannot copy to anywhere else, but thanks for suggesting. :)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can modify the resources section of the <build> bit of the POM:

<resources>
  <resource>
    <directory>src/main/resources</directory>
  </resource>
  <resource>
    <filtering>false</filtering>
    <directory>src/main/java</directory>
    <includes>
      <include>*.rb</include>
    </includes>
    <excludes>
      <exclude>**/*.java</exclude>
    </excludes>
  </resource>
</resources>

Or, the other answer (create the same package structure in src/main/resources) will also work.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...