|
|
(6 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | This sections is meant to provide operative instructions about most relevant aspects of creation of ETICS configurations for Maven-based components.
| + | [[Category: Developer's Guide]] |
− | | + | moved to [[ETICS#How_to_create_ETICS_configurations_for_gCube_components]] |
− | == Versioning ==
| + | |
− | Version field of the ETICS configuration '''must match''' the version specified for the Maven project in the ''pom.xml'', excepting for the "-SNAPSHOT" postfix. The match will be checked during the invocation of mvn to guarantee that ETICS versions are always in sync with Maven versions.
| + | |
− | | + | |
− | == Build Commands ==
| + | |
− | | + | |
− | * the ''compile'' target of their ''Build Commands'' must invoke Maven to build the components '''up to the deploy phase''' (e.g. <code>mvn deploy</code>). This allows the deployment of components into Maven repositories directly from ETICS builds
| + | |
− | | + | |
− | * the ''install'' target of their ''Build Commands'' must '''copy the gCube profile of the component in the <code>${prefix}</code>''' directory. This allows the registration of the profile with the Software Gateway when the component is released. It remains a good practice to copy also the outcome of the compilation (usually jar files) in <code>${prefix}</code> in order to include them in packages generated by ETICS
| + | |
− | | + | |
− | | + | |
− | Sample build commands for a maven-based component should look like the one in the picture below:
| + | |
− | | + | |
− | [[Image:maven-component-configuration.png|600px|center|Example of maven-component's build commands]] | + | |
− | | + | |
− | == Dependencies ==
| + | |
− | The configuration must directly or indirectly '''depend on the ETICS configurations of all gCube components that are specified in the POM''', including ''maven-parent''. This guarantees that at build-time all dependencies requested by the pom.xml have been already compiled and installed on the Maven's local reposiotry.
| + | |
− | | + | |
− | Dependencies on '''third-party components''' available in Maven Central (or other Maven repository specified in the POM) do '''not''' need to be configured in ETICS (i.e. Maven repositories replace ETICS ''externals'').
| + | |
− | | + | |
− | All dependencies must be declared of type '''dynamic''' and the actual version will be resolved at project level.
| + | |
− | | + | |
− | | + | |
− | Example of dependencies for a Maven component:
| + | |
− | [[Image:Maven-deps.png|700px|center|Example of maven-component's dependency set]] | + | |
− | | + | |
− | == Environment ==
| + | |
− | Unlike Ant-based components, Maven components do not use the <code>CLASSPATH</code> variable for compile-time dependency resolution, but rely on the Maven local repository. This means that the Environment section of Maven component's configurations '''will be empty''' (unless other environment variables has to be set for other purposes).
| + | |
− | | + | |
− | There exist an exception, though. If the component's artifact is meant to be used as compile-time dependency by others Ant-based components, the artifact produced by the Maven build needs to be ''exported'' in the CLASSPATH to allows the Ant-based component to find it. Only in this case the Environment section will contain an entry to add to CLASSPATH the artifact produced. It is suggested to use following convention:
| + | |
− | <pre>
| + | |
− | CLASSPATH: ${moduleDir}/target/<artifactid>-${version}-[SNAPSHOT|${maven.system-version}].jar
| + | |
− | </pre>
| + | |
− | where:
| + | |
− | * <artifactId> must be replaced with the name of the artifact produced by Maven compilation. By default it is the same of <artifactId> value in the pom
| + | |
− | * <code>SNAPSHOT</code> must be added only if you are setting up a configuration for org.gcube.HEAD otherwise
| + | |
− | * you should use the <code>${maven.system-version}</code> property
| + | |
− | * <code>${moduleDir}</code> and <code>${version}</code> are ETICS properties and will be resolved by ETICS itself
| + | |
− | | + | |
− | Valid examples of CLASSPATH:
| + | |
− | <pre>
| + | |
− | CLASSPATH: ${moduleDir}/target/home-library-${version}-${maven.system-version}.jar
| + | |
− | CLASSPATH: ${moduleDir}/target/home-library-${version}-SNAPSHOT.jar
| + | |
− | CLASSPATH: ${moduleDir}/SoftwareGateway-stubs/target/softwaregateway-stubs-${version}-${maven.system-version}.jar
| + | |
− | CLASSPATH: ${moduleDir}/SoftwareGateway-stubs/target/softwaregateway-stubs-${version}-SNAPSHOT.jar
| + | |
− | ...
| + | |
− | </pre>
| + | |
− | | + | |
− | '''Tip''': you can easily find exactly which artifact is created during an ETICS build by searching in the build report of the component for the line "''Installing /home/gbuilder/catalogueoflife-spd-plugin/<span style="background-color:#E6E6FA">target/catalogue-of-life-spd-plugin-1.0.0.jar</span> to...''"
| + | |