mirror of https://github.com/apache/openjpa.git
Added openjpa-all module which will manually create an openjpa-all-VERSION.jar file that aggregates all the other openja-*.jar files; fixed Configurations.java to provide more information when a missing services resource is caused by a deeper exception
git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@441318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
1e5d09ce2f
commit
812e184e89
|
@ -0,0 +1,91 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>openjpa-all</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>OpenJPA Aggregate Jar</name>
|
||||
<parent>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa</artifactId>
|
||||
<version>0.9.0-incubating-SNAPSHOT</version>
|
||||
</parent>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!--
|
||||
Manually build an aggregate jar of all the other
|
||||
openjpa-* jars using ant. We cannot use the assembly
|
||||
plugin, since it doesn't provide support for appending
|
||||
multiple same-named files to each other (which is
|
||||
required for correctly aggregating services files).
|
||||
-->
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>build-single-jar</id>
|
||||
<phase>package</phase>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<unjar overwrite="false"
|
||||
dest="${basedir}/target/classes">
|
||||
<fileset dir="${basedir}/..">
|
||||
<include name="*/target/openjpa-*.jar"/>
|
||||
</fileset>
|
||||
</unjar>
|
||||
|
||||
<!--
|
||||
need to manually concatinate the services
|
||||
resources so they are aggregated
|
||||
-->
|
||||
<macrodef name="aggregate-file">
|
||||
<attribute name="servicename"/>
|
||||
<sequential>
|
||||
<echo>Building service: @{servicename}</echo>
|
||||
<concat destfile="${basedir}/target/classes/META-INF/services/@{servicename}">
|
||||
<fileset dir="${basedir}/.." includes="*/src/main/resources/META-INF/services/@{servicename}"/>
|
||||
</concat>
|
||||
</sequential>
|
||||
</macrodef>
|
||||
|
||||
<aggregate-file servicename="org.apache.openjpa.conf.ProductDerivation"/>
|
||||
<aggregate-file servicename="javax.persistence.spi.PersistenceProvider"/>
|
||||
<aggregate-file servicename="org.apache.openjpa.kernel.exps.ExpressionParser"/>
|
||||
<aggregate-file servicename="org.apache.openjpa.lib.conf.ConfigurationProvider"/>
|
||||
</tasks>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
create enhancer pre-main attribute
|
||||
copied from openjpa-kernel-5/pom.xml
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifestEntries>
|
||||
<Premain-Class>
|
||||
org.apache.openjpa.enhance.PCEnhancerAgent</Premain-Class>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa-persistence-jdbc</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -18,8 +18,10 @@ package org.apache.openjpa.lib.conf;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Properties;
|
||||
|
@ -30,6 +32,7 @@ import javax.naming.NamingException;
|
|||
|
||||
import org.apache.commons.lang.exception.NestableRuntimeException;
|
||||
import org.apache.openjpa.lib.log.Log;
|
||||
import org.apache.openjpa.lib.util.JavaVersions;
|
||||
import org.apache.openjpa.lib.util.Localizer;
|
||||
import org.apache.openjpa.lib.util.Options;
|
||||
import org.apache.openjpa.lib.util.ParseException;
|
||||
|
@ -466,36 +469,40 @@ public class Configurations {
|
|||
(ConfigurationProvider.class, loader);
|
||||
ConfigurationProvider provider = null;
|
||||
int providerCount = 0;
|
||||
StringBuffer errs = null;
|
||||
List errs = null;
|
||||
for (int i = 0; i < impls.length; i++) {
|
||||
provider = newProvider(impls[i]);
|
||||
try {
|
||||
provider = (ConfigurationProvider) impls[i].newInstance();
|
||||
if (provider == null)
|
||||
continue;
|
||||
|
||||
providerCount++;
|
||||
try {
|
||||
|
||||
if ((globals && provider.loadGlobals(loader))
|
||||
|| (!globals && provider.loadDefaults(loader)))
|
||||
return provider;
|
||||
} catch (MissingResourceException mre) {
|
||||
throw mre;
|
||||
} catch (Exception e) {
|
||||
if (errs == null)
|
||||
errs = new StringBuffer();
|
||||
else
|
||||
errs.append(", ");
|
||||
errs.append(e.toString());
|
||||
} catch (Throwable t) {
|
||||
(errs == null ? errs = new ArrayList() : errs).add(t);
|
||||
}
|
||||
}
|
||||
|
||||
String type = (globals) ? "globals" : "defaults";
|
||||
MissingResourceException ex = null;
|
||||
|
||||
if (errs != null)
|
||||
throw new MissingResourceException(errs.toString(),
|
||||
ex = new MissingResourceException(errs.toString(),
|
||||
Configurations.class.getName(), type);
|
||||
if (providerCount == 0)
|
||||
throw new MissingResourceException(_loc.get ("no-providers",
|
||||
else if (providerCount == 0)
|
||||
ex = new MissingResourceException(_loc.get ("no-providers",
|
||||
ConfigurationProvider.class.getName()).getMessage(),
|
||||
Configurations.class.getName(), type);
|
||||
|
||||
if (ex != null)
|
||||
throw (MissingResourceException) JavaVersions.initCause(ex,
|
||||
errs.size() == 0 ? null : (Throwable) errs.get(0));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
|
||||
Thanks!
|
||||
Thank you for downloading this incubator release of OpenJPA. For
|
||||
documentation and project information, please see:
|
||||
|
||||
http://incubator.apache.org/openjpa/
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
<include>NOTICE*</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<!--
|
||||
<fileSet>
|
||||
<directory>licenses</directory>
|
||||
<outputDirectory>/lib</outputDirectory>
|
||||
|
@ -31,6 +32,7 @@
|
|||
<directory>target/examples</directory>
|
||||
<outputDirectory>/examples</outputDirectory>
|
||||
</fileSet>
|
||||
-->
|
||||
</fileSets>
|
||||
<dependencySets>
|
||||
<dependencySet>
|
||||
|
@ -65,30 +67,43 @@
|
|||
|
||||
<!-- optional -->
|
||||
<exclude>junit:junit</exclude>
|
||||
|
||||
<!-- these are placed in the modules/ directory -->
|
||||
<exclude>org.apache.openjpa:openjpa-all</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-lib</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-kernel</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-kernel-4</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-kernel-5</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-jdbc</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-jdbc-5</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-persistence</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-persistence-jdbc</exclude>
|
||||
<exclude>org.apache.openjpa:openjpa-xmlstore</exclude>
|
||||
</excludes>
|
||||
</dependencySet>
|
||||
|
||||
|
||||
<!--
|
||||
<dependencySet>
|
||||
<outputDirectory>/optional</outputDirectory>
|
||||
<outputDirectory>/modules</outputDirectory>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
<includes>
|
||||
<include>org.apache.derby:derby</include>
|
||||
<include>org.apache.openjpa:openjpa-lib</include>
|
||||
<include>org.apache.openjpa:openjpa-kernel</include>
|
||||
<include>org.apache.openjpa:openjpa-kernel-4</include>
|
||||
<include>org.apache.openjpa:openjpa-kernel-5</include>
|
||||
<include>org.apache.openjpa:openjpa-jdbc</include>
|
||||
<include>org.apache.openjpa:openjpa-jdbc-5</include>
|
||||
<include>org.apache.openjpa:openjpa-persistence</include>
|
||||
<include>org.apache.openjpa:openjpa-persistence-jdbc</include>
|
||||
<include>org.apache.openjpa:openjpa-xmlstore</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<dependencySet>
|
||||
<outputDirectory>/</outputDirectory>
|
||||
<unpack>false</unpack>
|
||||
<scope>runtime</scope>
|
||||
<includes>
|
||||
<include>org.apache.openjpa:openjpa-all</include>
|
||||
</includes>
|
||||
</dependencySet>
|
||||
-->
|
||||
</dependencySets>
|
||||
</assembly>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>openjpa-project</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>OpenJPA Project</name>
|
||||
<name>OpenJPA Distribution</name>
|
||||
<parent>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa</artifactId>
|
||||
|
@ -78,7 +78,7 @@
|
|||
<id>bin</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>attached</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptor>assembly.xml</descriptor>
|
||||
|
@ -91,7 +91,7 @@
|
|||
<id>sources</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>assembly</goal>
|
||||
<goal>attached</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<descriptor>source-assembly.xml</descriptor>
|
||||
|
@ -134,6 +134,11 @@
|
|||
|
||||
<!-- need to explicitly list dependencies for assembly to work -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa-all</artifactId>
|
||||
<version>${pom.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.openjpa</groupId>
|
||||
<artifactId>openjpa-lib</artifactId>
|
||||
|
|
Loading…
Reference in New Issue