OpenJPA Logo   ASF Logo

Aggregate jars

Right now, we have a ton of jars, most of which are needed to actually run OpenJPA. For real users, we should create aggregates of these jars, for example:

openjpa-0.9.0-full.jar contains all openjpa code, openjpa-*.jars merged
openjpa-0.9.0-nodep.jar contains all openjpa code and all third party dependency jars

See the related JIRA item:

Maven assemblies

There's a way to build these using maven.

Declare the maven-assembly-plugin

Add the maven-assembly-plugin to the "build" section of your pom.xml like so:

pom.xml
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>assembly</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <descriptors>
            <descriptor>src/main/assembly/full.xml</descriptor>
            <descriptor>src/main/assembly/nodep.xml</descriptor>
          </descriptors>
        </configuration>
      </plugin>
    </plugins>
  </build>

Create the "full" assembly descriptor

In the directory "src/main/assembly/", create the following file:

full.xml
<assembly>
  <id>full</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <unpack>true</unpack>
      <scope>runtime</scope>
      <includes>
          <include>org.apache.openjpa:openjpa-jdbc-5</include>
          <include>org.apache.openjpa:openjpa-jdbc</include>
          <include>org.apache.openjpa:openjpa-kernel-4</include>
          <include>org.apache.openjpa:openjpa-kernel-5</include>
          <include>org.apache.openjpa:openjpa-kernel</include>
          <include>org.apache.openjpa:openjpa-lib</include>
          <include>org.apache.openjpa:openjpa-persistence-jdbc</include>
          <include>org.apache.openjpa:openjpa-persistence</include>
          <include>org.apache.openjpa:openjpa-project</include>
          <include>org.apache.openjpa:openjpa-xmlstore</include>
      </includes>
    </dependencySet>
  </dependencySets>
</assembly>

Create the "nodep" assembly descriptor

Also in the directory "src/main/assembly/", create the following file:

full.xml
<assembly>
  <id>full</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>
Copyright (C) 2006,2010 The Apache Software Foundation. Licensed under Apache License 2.0.
Apache, the Apache feather logo and OpenJPA are trademarks of The Apache Software Foundation.
Other names may be trademarks of their respective owners.