tags:

views:

53

answers:

1

I have a maven project with the following packages (for illustration only):

Root: src/main/java

  • /com/foo
  • /com/foo/api
  • /com/foo/impl

Now I want to create a jar which includes only code in /com/foo/api and /com/foo/impl.

How does one hack pom.xml to do this ? Thanks all.

+1  A: 

Easy, use the <includes> tag on the jar plugin:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <configuration>
    <includes>
      <include>/com/foo/api/*</include>
      <include>/com/foo/impl/*</include>
    </includes>
  </configuration>
</plugin>

There's a section on including/excluding in the usage section of the plugin doc.

sblundy
Thanks. But I used **/foo/api/* and **/foo/impl/* as the include fileset and it works.
ashitaka