GeoTools : EFeatureDataStore Build

Dependencies issues

EFeature module depends on the following Eclipse plug-ins and classes (artifacts in standard repos in brackets):

  • org.eclipse.emf.query [org.eclipse.emf:query]
    -> org.eclipse.core.runtime
    -> org.eclipse.emf.ecore [org.eclipse.emf:ecore]
    -> com.ibm.icu
  • org.eclipse.emf.edit [org.eclipse.emf:edit]
    -> org.eclipse.core.runtime
    -> org.eclipse.emf.common [org.eclipse.emf:common]
    -> org.eclipse.emf.ecore
    -> org.eclipse.emf.ecore.change (optional) [org.eclipse.emf.ecore:change]
  • org.eclipse.emf.workspace
    -> org.eclipse.core.runtime
    -> org.eclipse.core.resources [org.eclipse.core:resources]
    -> org.eclipse.core.commands [org.eclipse.core:commands]
    -> org.eclipse.emf.transaction 
  • org.eclipse.emf.transaction* *[org.eclipse.emf:transaction]
    -> org.eclipse.core.runtime
    -> org.eclipse.emf.ecore
    -> org.eclipse.emf.validation
    -> org.eclipse.emf.ecore.change
  • org.eclipse.emf.validation [org.eclipse.emf:validation]
    -> org.eclipse.core.runtime
    -> org.eclipse.core.resources [org.eclipse.core:resource]
    -> org.eclipse.core.expressions [org.eclipse.core:resource]
    -> org.eclipse.emf.ecore
    -> org.eclipse.emf.ecore.edit [org.eclipse.em.ecore:edit]
    -> com.ibm.icu
  • org.eclipse.core.runtime [org.eclipse.core:runtime]
    -> org.eclipse.osgi [org.eclipse:osgi]
    -> org.eclipse.core.jobs [org.eclipse:osgi]
    -> org.eclipse.core.contenttype [org.eclipse.core:contenttype]
    -> org.eclipse.core.runtime.compability.auth [org.eclipse.core.runtime.compabiltiy:auth]
    -> org.eclipse.equinox.common [org.eclipse.equinox:common]
    -> org.eclipse.equinox.registry [org.eclipse.equinox:registry]
    -> org.eclipse.equinox.preferences [org.eclipse.equinox:preferences]
    -> org.eclipse.equinox.app[org.eclipse.equinox:app]

Dependencies shown in bold indicates that they are proposed to added to GeoTools SNAPSHOT and release repositories. Dependencies shown in read indicate that an error occurs when it or it's parent is added to the EFeature pom-file. Dependencies in blue exist standard repos and produce no errors when is or it's parent is added to the EFeature pom-file.

The dependency version range mismatch problem

The only EMF Query artifact available from standard repos is org.eclipse.emf:query:1.1.0-v200706071712 (central maven repo). Adding dependency 

<dependency>
    <groupId>org.eclipse.emf</groupId>
    <artifactId>query</artifactId>
    <version>1.1.0-v200706071712</version>
    <type>jar</type>
    <scope>compile</scope>
</dependency>

to the EFeature pom-file produces the following error:

./unsupported/efeature> mvn install
...
...
[ERROR] An error occurred during dependency resolution of the following artifact:
    org.eclipse.equinox:app:null
Caused by: Couldn't find a version in [1.0.0-v20070606] to match range [1.0.0,2.0.0)
  org.eclipse.equinox:app:jar:null

from the specified remote repositories:
  central (http://repo1.maven.org/maven2),
  wso2.org (http://dist.wso2.org/maven2/),
  osgeo (http://download.osgeo.org/webdav/geotools/),
  maven2-repository.dev.java.net (http://download.java.net/maven/2),
  opengeo (http://repo.opengeo.org)

Path to dependency:
	1) org.geotools:gt-efeature:jar:8-SNAPSHOT
	2) org.eclipse.emf:query:jar:1.1.0-v200706071712
	3) org.eclipse.core:runtime:jar:3.3.100-v20070530

As the dependency path shows, org.eclipse.core:runtime:3.3.100-v20070530 depends on org.eclipse.equinox.app:1.0.0-v20070606, a qualifier version which is not part of the version range [1.0.0, 2.0.0). The reason is that Maven2 evaluates all qualifier versions as before (less that) the version without the qualifier. Thus, Maven2 evaluates the version 1.0.0-qualifier to be less than the version 1.0.0 (which makes sense). However, problems occur when artifacts are deployed with version qualifiers, and artifacts dependent on these defines a version range without qualifiers. F.ex, artifact A with version 1.0.0-qualifier is deployed to a repository. Any artifacts depending on versions of A in the range [1.0.0,2.0.0) will not match 1.0.0-qualifier since 1.0.0-qualifier < 1.0.0. If all qualifier versions of A should be included in this range, the range must be restated as [1.0.0-!,2.0.0), where -! express "include all qualifier versions starting with 1.0.0.". One solution is to redefine the version range for the dependency on org.eclipse.equinox.app in org.eclipse.core:runtime:3.3.100-v20070530 to [1.0.0-!,2.0.0). However, this requires local changes to the org.eclipse.core:runtime artifact. This solution is not very portable.

A better solution is to add the following dependency:

<dependencies>
...    
    <dependency>
      <groupId>org.eclipse.equinox</groupId>
      <artifactId>app</artifactId>
      <version>1.0.0-v20070606</version>
    </dependency>

</dependencies>

to the <dependencyManagement> element in the global pom file located at ../trunk. Similar problems also occurs when adding dependencies:

  • org.eclipse.emf:edit
  • org.eclipse.emf.workspace
  • org.eclipse.emf.transaction
  • org.eclipse.emf.validation
  • org.eclipse.core.runtime

which is solved one again by adding the following dependencies to ..\trunk\pom.xml

<dependencies>
...    
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>edit</artifactId>
      <version>2.3.0-v200706262000</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>query</artifactId>
      <version>1.2.100-v200903190031</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>workspace</artifactId>
      <version>1.1.0-v200706131240</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>transaction-v200706131240</artifactId>
      <version>1.1.0</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>validation</artifactId>
      <version>1.1.0</version>
    </dependency>

</dependencies>

Artifacts that should be added to GeoTools

Artifacts with errors should be redefined added to GeoTools repos. It is very unlikely that these will be fixed (central repo policy is "do not change"). 

org.eclipse.emf:query:1.2.100-v200903190031!

The only version of org.eclipse.emf.query available from standard repos is 1.1.0-v200706071712, which is to old. The org.eclipse.emf.query.conditions.IDateTypeAdapter class is used by EFeature, and was not added to EMF Query until version 1.2.

The qualifier version 1.2.100.v200903190031 deployed to http://dist.wso2.org/maven2, contains the necessary classes. Before deploying it to GeoTools repos, the POM file must be modified. To prepare for this, download the artifact and install it manually into the local repo:

mkdir query
cd query
wget -r --no-parent -nH -k --cut-dirs=5 -A".jar,.xml,.pom,.md5,.sha1" http://dist.wso2.org/maven2/org/eclipse/emf/org.eclipse.emf.query/
cd 1.2.100.v200903190031

nano org.eclipse.emf.query-1.2.100.v200903190031.pom
<change artifact Id from org.eclipse.emf.query to query>
mvn install:install-file -Dfile=org.eclipse.emf.query-1.2.100.v200903190031.jar -DpomFile=org.eclipse.emf.query-1.2.100.v200903190031.pom -Dversion=1.1.0-v200706071520
cd <path-to-local-repo>/org/eclipse/emf/query/1.2.100-v200903190031!nano query-1.2.100-v200903190031!.pom<change version from 1.2.100-v200903190031 to 1.2.100-v200903190031!>

Open the file query-1.2.100-v200903190031!.pom just created in catalog <local-repo-root>/org/eclipse/emf/query/1.2.100-v200903190031! and add the following dependencies (the installed one have none)

<dependencies>
...
    <dependency>
      <groupId>org.eclipse.core</groupId>
      <artifactId>runtime</artifactId>
      <version>[3.2.0,4.0.0)</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse.emf</groupId>
      <artifactId>ecore</artifactId>
      <version>[2.2.0,3.0.0)</version>
    </dependency>
    <dependency>
      <groupId>com.ibm.icu</groupId>
      <artifactId>icu4j</artifactId>
      <version>[3.4.3,4.0.0)</version>
    </dependency>

</dependencies>

All of these dependencies are available in the standard repos defined in the global pom file in GeoTools. Adding them here is better than adding adding them as siblings to the EFeature pom-file, since org.eclipse.emf.query expect to find them on the classpath. To verify this, just open the Eclipse plugin definition file for org.eclipse.emf.query as check the dependencies tab. Another reason for adding the dependencies here, is that it makes it easier for others to include EMF Query to geotool modules later on.

Note that the org.eclipse.emf:query:1.1.0-v200706071712 artifact at the central repo depends on com.ibm:icu:[3.4.3,4.0.0) which does not exist. The correct version is com.ibm.icu:icu4j:[3.4.3,4.0.0), which is the version that is used in the the redefined query-1.2.100-v200903190031.pom file.

org.eclipse.emf.validation:1.1.0-v200706071520!

The org.eclipse.emf.validation:1.1.0-v200706071520 artifact at the central repo depends on com.ibm:icu:[3.4.3,4.0.0) which does not exist. The correct version is com.ibm.icu:icu4j:[3.4.3,4.0.0). This is problem is solved once again by redefining the pom file following these steps:

# install EMF Validation
cd /path/to/tmp
mkdir validation
cd validationwget -r -nH -k --cut-dirs=7 -A".jar,.xml,.pom,.md5,.sha1" ftp://mirrors.ibiblio.org/pub/mirrors/maven2/org/eclipse/emf/validation/
cd 1.1.0-v200706071520
mvn install:install-file -DpomFile=validation-1.1.0-v200706071520.pom -Dfile=validation-1.1.0-v200706071520.jar -Dversion=1.1.0-v200706071520!cd <path-to-local-repo>/org/eclipse/emf/validation/1.1.0-v200706071520!nano validation-1.1.0-v200706071520!.pom<change version from 1.1.0-v200706071520 to 1.1.0-v200706071520!>