...
There are a number of strategies for building the OpenNCP Server and bundling the local classesin the National jar, for example:
- Build epsos-ws-server.war in a local build environment using maven profile "national-connector-impl" to include the local classes as a dependency. The disadvantage with this approach is that the local build server must download all the source files from Google Code repository plus all dependencies from Joinup.
- Download a released epsos-ws-server.war from Joinup. Use a local build script to unpack the archive, bundle in the local classes and then repackage. This is the preferred approach in Sweden.
- Download epsos-ws-server.war from Joinup. Add local classes to tomcat/lib. This has been briefly tested and did not work due to class loader errors. Furthermore it is never a good idea to deploy application-specific classes into tomcat/lib.
Local build using profile
Here are the profiles that are declared in the Protocol Terminator pom file.
Code Block | ||
---|---|---|
| ||
<profiles> <profile> <!-- This profile bundles a mock National Connector implementation --> <id>national-connector-mock-impl</id> <dependencies> <dependency> <groupId>eu.europa.ec.joinup.ecc.epsos-protocol-terminators.epsos-ncp-server</groupId> <artifactId>epsos-nc-mock-it</artifactId> <version>0.1-SNAPSHOT</version> <scope>runtime</scope> </dependency> </dependencies> </profile> <profile> <!-- This profile bundles the real National Connector implementation --> <id>national-connector-impl</id> <dependencies> <dependency> <groupId>${national-connector-impl.groupId}</groupId> <artifactId>${national-connector-impl.artifactId}</artifactId> <version>${national-connector-impl.version}</version> <scope>runtime</scope> </dependency> </dependencies> </profile> </profiles> |
The first profile bundles the a mock implementations implementation into the war file. The second profile bundles a National implementation. If no profile is specified then no implementation will be bundled at all. In this case, the jar must be deployed to the tomcat/lib directory.The National profile needs some properties. These properties are defined
To use the National profile some properties must be set in the local build environment. There are a few options for doing this:
Per User
- Defined in the Maven-settings (%USER_HOME%/.m2/settings.xml).
...
Code Block | ||
---|---|---|
| ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <profiles> <profile> <id>national-connector-impl</id> <properties> <national-connector-impl.groupId>se.apotekensservice</national-connector-impl.groupId> <national-connector-impl.artifactId>epsos-shelob</national-connector-impl.artifactId> <national-connector-impl.version>0.0.1-SNAPSHOT<version>1.1</national-connector-impl.version> </properties> </profile> </profiles> </settings> |
Here are the Maven commands for activating the various profiles:
Code Block | ||
---|---|---|
| ||
# build epsos-ws-serverwith no implementation mvn clean install # build epsos-ws-server with mock implementations mvn clean install -P national-connector-mock-impl # build epsos-ws-server with real implementations mvn clean install -P national-connector-impl |
...
Code Block | ||
---|---|---|
| ||
<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/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>epsos</artifactId> <groupId>se.apotekensservice</groupId> <version>1.1</version> </parent> <artifactId>epsos-ws-server</artifactId> <packaging>war</packaging> <name>OpenNCP Server (Country A)</name> <description>This project downloads the OpenNCP epsos-ws-server.war and bundles in the Swedish functionality (Shelob)<National implementations</description> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependencywar-plugin</artifactId> <version>2.5.1<3</version> <executions><configuration> <execution> <packagingExcludes>**/epsos*-mock-*.jar</packagingExcludes> <id>unpack<</id>configuration> </plugin> </plugins> <phase>package<</phase>build> <dependencies> <dependency> <goals><groupId>se.apotekensservice</groupId> <artifactId>epsos-shelob</artifactId> <goal>unpack</goal> <version>1.1</version> </goals>dependency> <configuration> <artifactItems> <artifactItem> <groupId>${project.openNcpGroupId}</groupId> <artifactId>${project.openNcpArtifactId}</artifactId> <version>${project.openNcpVersion}</version> <type>war</type> <overWrite>true</overWrite> <outputDirectory>${project.build.directory}/epsos-ws-server</outputDirectory> <includes></includes> <excludes>**/epsos*-mock-*.jar</excludes> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>${project.shelobGroupId}</groupId> <artifactId>${project.shelobArtifactId}</artifactId> <version>${project.shelobVersion}</version> </dependency> <dependency> <groupId>${project.openNcpGroupId}</groupId> <artifactId>${project.openNcpArtifactId}</artifactId> <version>${project.openNcpVersion}</version> <type>war</type> </dependency> </dependencies> <properties> <!-- OpenNCP war --> <project.openNcpGroupId>eu<dependency> <groupId>eu.europa.ec.joinup.ecc.epsos-protocol-terminators.epsos-ncp-server</project.openNcpGroupId> <project.openNcpArtifactId>epsos-ws-server</project.openNcpArtifactId> <project.openNcpVersion>2.0.0-SNAPSHOT</project.openNcpVersion> <!-- Shelob jar (National implementations for bundling into OpenNCP --> <project.shelobGroupId>se.apotekensservice</project.shelobGroupId> <project.shelobArtifactId>epsos-shelob</project.shelobArtifactId> <project.shelobVersion>1.1</project.shelobVersion> </properties>-ncp-server</groupId> <artifactId>epsos-ws-server</artifactId> <version>2.0.0-SNAPSHOT</version> <type>war</type> </dependency> </dependencies> </project> |
XCPD PatientSearchInterface usage
...