| <?xml version="1.0"?> |
| <!-- |
| * © 2016 and later: Unicode, Inc. and others. |
| * License & terms of use: http://www.unicode.org/copyright.html |
| ******************************************************************************* |
| * Copyright (C) 2010-2016, International Business Machines Corporation and * |
| * others. All Rights Reserved. * |
| ******************************************************************************* |
| --> |
| <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"> |
| |
| <parent> |
| <groupId>com.ibm.icu</groupId> |
| <artifactId>icu4j-root</artifactId> |
| <version>73.1-SNAPSHOT</version> |
| <!-- default relativePath for parent --> |
| </parent> |
| |
| <modelVersion>4.0.0</modelVersion> |
| |
| <groupId>com.ibm.icu</groupId> |
| <artifactId>icu4j-localespi</artifactId> |
| <version>73.1-SNAPSHOT</version> |
| |
| <packaging>jar</packaging> |
| |
| <name>ICU4J Locale Service Provider</name> |
| <description>icu4j-localespi is a supplemental library for icu4j, implementing Java Locale SPI.</description> |
| |
| <properties> |
| <!-- Bundle-SymbolicName --> |
| <jar.symbolic.name>org.ibm.icu.localespi</jar.symbolic.name> |
| </properties> |
| |
| <build> |
| <plugins> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-compiler-plugin</artifactId> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>build-helper-maven-plugin</artifactId> |
| <executions> |
| |
| <!-- add directories with main executable code --> |
| <execution> |
| <id>add-source</id> |
| <goals> |
| <goal>add-source</goal> |
| </goals> |
| <configuration> |
| <sources> |
| <source>../../main/classes/localespi/src</source> |
| </sources> |
| </configuration> |
| </execution> |
| |
| <!-- add directories with test code --> |
| <execution> |
| <id>add-test-source</id> |
| <goals> |
| <goal>add-test-source</goal> |
| </goals> |
| <configuration> |
| <sources> |
| <source>../../main/tests/localespi/src</source> |
| <source>../../main/tests/framework/src</source> |
| </sources> |
| </configuration> |
| </execution> |
| |
| <!-- add directories with main executable resources --> |
| <execution> |
| <id>add-resource</id> |
| <goals> |
| <goal>add-resource</goal> |
| </goals> |
| <configuration> |
| <resources> |
| <resource> |
| <directory>../../main/classes/localespi/src</directory> |
| <excludes> |
| <exclude>**/*.java</exclude> |
| </excludes> |
| </resource> |
| </resources> |
| </configuration> |
| </execution> |
| |
| <!-- add directories with test resources --> |
| <execution> |
| <id>add-test-resource</id> |
| <goals> |
| <goal>add-test-resource</goal> |
| </goals> |
| <configuration> |
| <resources> |
| <resource> |
| <directory>../../main/tests/localespi/src</directory> |
| <excludes> |
| <exclude>**/*.java</exclude> |
| </excludes> |
| </resource> |
| <resource> |
| <directory>../../main/tests/framework/src</directory> |
| <excludes> |
| <exclude>**/*.java</exclude> |
| </excludes> |
| </resource> |
| </resources> |
| </configuration> |
| </execution> |
| |
| |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <artifactId>maven-surefire-plugin</artifactId> |
| <configuration> |
| <!-- |
| Do not run localespi tests as unit tests because they depend on loading the main code via a .jar file |
| via the Java extensions mechanism. |
| --> |
| <skipTests>true</skipTests> |
| </configuration> |
| </plugin> |
| |
| <!-- |
| Mainly for running localespi tests in Java 8: |
| The easiest way to get the integration tests to pass (in particular, to get the JVM that is |
| spawned with the `-Djava.ext.dirs` system property value to be interpreted properly in order |
| for the extensions jars therein to be loaded correctly) was to copy the jars needed to a |
| separate directory. (The alternative of pointing to the build directories of the respective |
| submodules didn't seem to work.) |
| |
| This isn't of much use for Java 9+, in which extensions are deprecated and the regular |
| classpath is to be used instead. |
| --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-dependency-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>it-test-copy-localespi-extension-jars</id> |
| <phase>integration-test</phase> |
| <goals> |
| <goal>copy</goal> |
| </goals> |
| <configuration> |
| <artifactItems> |
| <artifactItem> |
| <groupId>${project.groupId}</groupId> |
| <artifactId>icu4j</artifactId> |
| <version>${project.version}</version> |
| <type>${project.packaging}</type> |
| </artifactItem> |
| <artifactItem> |
| <groupId>${project.groupId}</groupId> |
| <artifactId>icu4j-localespi</artifactId> |
| <version>${project.version}</version> |
| <type>${project.packaging}</type> |
| </artifactItem> |
| </artifactItems> |
| <!-- https://stackoverflow.com/questions/36181371/how-can-i-get-the-temp-folder-of-a-machine-running-maven --> |
| <outputDirectory>${java.io.tmpdir}/ext-test-jars</outputDirectory> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-failsafe-plugin</artifactId> |
| <executions> |
| <execution> |
| <goals> |
| <goal>integration-test</goal> |
| </goals> |
| </execution> |
| </executions> |
| <configuration> |
| <includes> |
| <!-- treat localespi tests as integration tests because they depend on .jar files from package phase --> |
| <include>**/*.java</include> |
| <!-- default integration test wildcard patterns --> |
| <include>**/IT*.java</include> |
| <include>**/*IT.java</include> |
| <include>**/*ITCase.java</include> |
| </includes> |
| |
| <!-- |
| For Java 8: |
| Set up the locale service provider using the .jar file of `icu4j-localespi` main code from the `package` phase |
| |
| Leave empty for Java 9+. |
| Using the `java.ext.dirs` special Java system property on Java 9+ runtimes triggers an |
| error that tells the user to place those jars on the classpath instead. |
| --> |
| <!-- |
| Notes: |
| |
| https://stackoverflow.com/a/5039973/2077918 |
| The `java.ext.dirs` is a special Java system property that activates the Java extension mechanism. |
| The Java extension mechanism was deprecated in Java 8 (users are recommended to use `-classpath` instead), |
| and the extension mechanism was removed in Java 9 altogether. |
| For backwards compatibility testing for users of the Java extension mechansim, |
| this configuration achieves the effect of having the localespi code in a .jar file that gets loaded |
| by running this test in a phase following the `package` phase in which the .jar file is created. |
| |
| https://stackoverflow.com/questions/45223908/why-does-the-java-extension-mechanism-not-check-the-classpath-for-an-optional-pa |
| |
| For some reason, the plugin was effectively not honoring the values as expected that were set in |
| <systemPropertyVariables>, so instead, the <argLine> value was used to set the JVM options. This |
| approach was inspired by: https://stackoverflow.com/a/48213614/2077918 |
| --> |
| <argLine>${localespi-tests.jvm.args}</argLine> |
| |
| <!-- |
| For Java 9+: |
| Configure to use the locale service provider using the .jar file of `icu4j-localespi` main code from the `package` phase |
| |
| Leave empty for Java 8 to take defaults ("SPI,JRE"). |
| See: https://stackoverflow.com/questions/45223908/why-does-the-java-extension-mechanism-not-check-the-classpath-for-an-optional-pa |
| --> |
| <systemPropertyVariables> |
| <java.locale.providers>${localespi-tests.locale-providers}</java.locale.providers> |
| </systemPropertyVariables> |
| |
| </configuration> |
| </plugin> |
| |
| <!-- |
| Enable configuration of the Manifest file, etc. during the process of packaging the .jar file. |
| |
| For future reference: https://stackoverflow.com/questions/38548271/difference-between-maven-plugins-assembly-plugins-jar-plugins-shaded-plugi |
| --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-jar-plugin</artifactId> |
| <configuration> |
| <archive> |
| <manifestEntries> |
| |
| <X-Compile-Source-JDK>${maven.compiler.source}</X-Compile-Source-JDK> |
| <X-Compile-Target-JDK>${maven.compiler.target}</X-Compile-Target-JDK> |
| |
| <Specification-Title>${jar.spec.title}</Specification-Title> |
| <Specification-Version>${jar.spec.version}</Specification-Version> |
| <Specification-Vendor>${jar.spec.vendor}</Specification-Vendor> |
| |
| <Implementation-Title>${jar.impl.title}</Implementation-Title> |
| <Implementation-Version>${jar.impl.version}</Implementation-Version> |
| <Implementation-Vendor>${jar.impl.vendor}</Implementation-Vendor> |
| <Implementation-Vendor-Id>${jar.impl.vendor.id}</Implementation-Vendor-Id> |
| |
| <Bundle-ManifestVersion>${jar.manifest.version}</Bundle-ManifestVersion> |
| <Bundle-Name>${jar.name}</Bundle-Name> |
| <Bundle-Description>${jar.description}</Bundle-Description> |
| <Bundle-SymbolicName>${jar.symbolic.name}</Bundle-SymbolicName> |
| <Bundle-Version>${jar.version}</Bundle-Version> |
| <Bundle-Vendor>${jar.vendor}</Bundle-Vendor> |
| <Bundle-Copyright>${jar.copyright.info}</Bundle-Copyright> |
| |
| <!-- TODO: We should remove this, right??? --> |
| <Main-Class>${jar.main.class}</Main-Class> |
| |
| </manifestEntries> |
| </archive> |
| </configuration> |
| </plugin> |
| </plugins> |
| </build> |
| |
| <dependencies> |
| |
| <dependency> |
| <groupId>com.ibm.icu</groupId> |
| <artifactId>icu4j</artifactId> |
| </dependency> |
| |
| <dependency> |
| <groupId>com.ibm.icu</groupId> |
| <artifactId>icu4j-test-datafiles</artifactId> |
| <scope>provided</scope> |
| </dependency> |
| |
| <dependency> |
| <groupId>junit</groupId> |
| <artifactId>junit</artifactId> |
| </dependency> |
| |
| <!-- this is for parameterized JUnit tests --> |
| <dependency> |
| <groupId>pl.pragmatists</groupId> |
| <artifactId>JUnitParams</artifactId> |
| </dependency> |
| |
| </dependencies> |
| |
| </project> |