Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Include additional resources in a jar

Tags:

maven-2

I have compiled some class files and a jar file. Now i want to include some wsdl into the jar file .

Can you please tell me how can amend pom.xml in maven for achieving the same.

Regards Gnash--85

like image 328
NareshKumar Avatar asked Mar 23 '26 10:03

NareshKumar


1 Answers

Where do those WSDL files come from? Are they part of your source?

assuming you have

project
  + src
    + main
      + java
      + wsdl
      + resources

Please add in POM,

<project>
  ...
  <build>
    <resources>
      ...
      <resource>
        <directory>${basedir}/src/main/wsdl</directory>
      <resource>
    </resources>
   </build>
</project>

Then it should add your wsdl as extra resource


Edit:

There is an alternative way for which we don't need to update project.build.resources to include all resource directories.

This is by making use of Build Helper Plugin

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <id>add-wsdl-resource</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>add-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>${basedir}/src/main/wsdl</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
like image 176
Adrian Shum Avatar answered Mar 26 '26 14:03

Adrian Shum



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!