Jump to: navigation, search

EclipseSCADA/GettingStarted/WithMaven

Eclipse SCADA is built using Eclipse Tycho. So it uses maven as tool, but does not create plain maven repositories, it creates P2 repositories. If you are working inside Eclipse and OSGi this might be "ok", but sometimes it is good to use plain maven. For this the Eclipse SCADA P2 repositories are converted from P2 to maven using the tool EclipseSCADA/Build/P2toM2.

This produces a plain maven repository structure, which might not have the same quality as manually authored maven repository, still it works quite well.

Note.png
Java 7+
Eclipse SCADA requires Java 7+. Be sure to configure your maven project and runtime accordingly


Using

Add the following repository:

...
<repository>
	<id>eclipse.scada</id>
	<url>http://download.eclipse.org/eclipsescada/downloads/org.eclipse.scada/drops/0.2.0/S201410310907/maven/</url>
	<releases>
		<enabled>true</enabled>
	</releases>
	<snapshots>
		<enabled>true</enabled>
	</snapshots>
</repository>
...

Since Apache Mina uses the "maven-bundle-plugin" you will need to add this bundle to you "pom" file as well:

...
<plugins>
	<plugin>
		<groupId>org.apache.felix</groupId>
		<artifactId>maven-bundle-plugin</artifactId>
                <version>2.5.3</version>
		<extensions>true</extensions>
	</plugin>
</plugins>
...

Modules

All modules are converted using the groupId and artifactId that are already present by the Eclipse Tycho setup. So you actually can look them up in the POM files of the bundles.

However these POM files are not directly used, but re-created during the conversion.

In order to write a simple server (Hive) with an NGP exporter add the following dependencies:

...
 <dependencies>
	<dependency>
		<groupId>org.eclipse.scada.core</groupId>
		<artifactId>org.eclipse.scada.da.server.common</artifactId>
		<version>0.2.0</version>
	</dependency>
	
	<dependency>
		<groupId>org.eclipse.scada.core</groupId>
		<artifactId>org.eclipse.scada.da.server.ngp</artifactId>
		<version>0.2.0</version>
	</dependency>
</dependencies>
...

Transient dependencies

The conversion process also created dependencies in the POM files. These dependencies are coming from the P2 meta informations.

Since the P2 system can handle java package dependencies (as OSGi has), and maven cannot handle these, there is some change in the dependency informations when the P2 metadata is converted to maven.

Where P2 specifies the required dependencies, these are resolved using the provided P2 repositories (source and validating), and the result is placed into the resulting POM files as dependency.

So if a bundle requires "org.slf4j 1.6.0", it might resolve to "org.slf4j 1.7.2", since this is this version in the P2 repositories. The resulting POM file will contain a reference to "org.slf4j 1.7.2".

External dependencies

Eclipse SCADA uses all external dependencies from internal sources. Either from the "external" repository or from [Eclipse Orbit].

While this is ok inside Eclipse and OSGi, this is not what you would expect in a plain maven setup.

That is why all dependencies that are externally available as artifacts for maven from maven central are rewritten in the pom files.

The current list is in the configuration file used by p2tom2. http://git.eclipse.org/c/eclipsescada/org.eclipse.scada.releng.git/tree/aggregateRepositories/p2tom2.properties

At the moment of writing this is:

external.org.apache.mina.filter.compression=org.apache.mina:mina-filter-compression
external.org.apache.mina.core=org.apache.mina:mina-core

external.javax.inject=javax:javaee-api:7.0
external.javax.annotation=javax:javaee-api:7.0
external.javax.servlet=javax.servlet:javax.servlet-api
external.javax.ws.rs=javax.ws.rs:jsr311-api

external.org.junit=junit:junit

mirror.ch.qos.logback.slf4j=false
external.ch.qos.logback.classic=ch.qos.logback:logback-classic
external.ch.qos.logback.core=ch.qos.logback:logback-core

external.org.apache.felix.gogo.command=org.apache.felix.gogo:org.apache.felix.gogo.command
external.org.apache.felix.gogo.shell=org.apache.felix.gogo:org.apache.felix.gogo.shell
external.org.apache.felix.gogo.runtime=org.apache.felix.gogo:org.apache.felix.gogo.runtime

external.org.apache.sshd.core=org.apache.sshd:sshd
external.org.apache.commons.beanutils=commons-beanutils:commons-beanutils
external.org.apache.commons.codec=commons-codec:commons-codec
external.org.apache.commons.logging=commons-logging:commons-logging
external.org.apache.commons.collections=commons-collections:commons-collections
external.org.apache.commons.httpclient=commons-httpclient:commons-httpclient
external.org.apache.commons.daemon=commons-daemon:commons-daemon
external.org.apache.commons.dbcp=commons-dbcp:commons-dbcp
external.org.apache.commons.pool=commons-pool:commons-pool
external.org.apache.commons.io=commons-io:commons-io
external.org.apache.poi=org.apache.poi:poi

external.com.jcraft.jzlib=com.jcraft:jzlib

external.org.slf4j.api=org.slf4j:slf4j-api
external.org.slf4j.ext=org.slf4j:slf4j-ext

external.com.google.guava=com.google.guava:guava:{0}.{1}
external.com.google.gson=com.google.code.gson:gson

external.org.eclipse.osgi=org.osgi:org.osgi.core:4.2.0
external.osgi.enterprise=org.osgi:org.osgi.enterprise

Complete example

A complete example can be found at: http://git.eclipse.org/c/eclipsescada/org.eclipse.scada.samples.git/tree/org.eclipse.scada.samples.maven.client1