Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
482 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 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...