OpenSearch/distribution/pom.xml

256 lines
10 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>org.elasticsearch</groupId>
<artifactId>parent</artifactId>
2015-09-03 04:43:28 -04:00
<version>3.0.0-SNAPSHOT</version>
</parent>
<groupId>org.elasticsearch.distribution</groupId>
<artifactId>distributions</artifactId>
<packaging>pom</packaging>
<name>Distribution: Parent POM</name>
<properties>
<!-- Properties used for building RPM & DEB packages (see common/packaging.properties) -->
<packaging.elasticsearch.home.dir>/usr/share/elasticsearch</packaging.elasticsearch.home.dir>
<packaging.elasticsearch.bin.dir>/usr/share/elasticsearch/bin</packaging.elasticsearch.bin.dir>
<packaging.elasticsearch.conf.dir>/etc/elasticsearch</packaging.elasticsearch.conf.dir>
<packaging.elasticsearch.data.dir>/var/lib/elasticsearch</packaging.elasticsearch.data.dir>
<packaging.elasticsearch.user>elasticsearch</packaging.elasticsearch.user>
<packaging.elasticsearch.group>elasticsearch</packaging.elasticsearch.group>
<packaging.elasticsearch.log.dir>/var/log/elasticsearch</packaging.elasticsearch.log.dir>
<packaging.elasticsearch.plugins.dir>${packaging.elasticsearch.home.dir}/plugins</packaging.elasticsearch.plugins.dir>
<packaging.elasticsearch.pid.dir>/var/run/elasticsearch</packaging.elasticsearch.pid.dir>
<packaging.elasticsearch.systemd.dir>/usr/lib/systemd/system</packaging.elasticsearch.systemd.dir>
<packaging.elasticsearch.systemd.sysctl.dir>/usr/lib/sysctl.d</packaging.elasticsearch.systemd.sysctl.dir>
<packaging.elasticsearch.tmpfilesd.dir>/usr/lib/tmpfiles.d</packaging.elasticsearch.tmpfilesd.dir>
<!-- Properties for the license checker -->
<project.licenses.dir>${project.basedir}/../licenses</project.licenses.dir>
<project.licenses.check_target>${integ.scratch}</project.licenses.check_target>
<!-- we expect packaging formats to have integration tests, but not unit tests -->
<skip.unit.tests>true</skip.unit.tests>
</properties>
2015-08-01 14:02:14 -04:00
<!-- PUT TEST ONLY DEPS HERE. Let individual distributions figure out what they want -->
<dependencies>
<dependency>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>randomizedtesting-runner</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<scope>test</scope>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>test</scope>
</dependency>
[build] remove shaded elasticsearch version The shaded version of elasticsearch was built at the very beginning to avoid dependency conflicts in a specific case where: * People use elasticsearch from Java * People needs to embed elasticsearch jar within their own application (as it's today the only way to get a `TransportClient`) * People also embed in their application another (most of the time older) version of dependency we are using for elasticsearch, such as: Guava, Joda, Jackson... This conflict issue can be solved within the projects themselves by either upgrade the dependency version and use the one provided by elasticsearch or by shading elasticsearch project and relocating some conflicting packages. Example ------- As an example, let's say you want to use within your project `Joda 2.1` but elasticsearch `2.0.0-beta1` provides `Joda 2.8`. Let's say you also want to run all that with shield plugin. Create a new maven project or module with: ```xml <groupId>fr.pilato.elasticsearch.test</groupId> <artifactId>es-shaded</artifactId> <version>1.0-SNAPSHOT</version> <properties> <elasticsearch.version>2.0.0-beta1</elasticsearch.version> </properties> <dependencies> <dependency> <groupId>org.elasticsearch</groupId> <artifactId>elasticsearch</artifactId> <version>${elasticsearch.version}</version> </dependency> <dependency> <groupId>org.elasticsearch.plugin</groupId> <artifactId>shield</artifactId> <version>${elasticsearch.version}</version> </dependency> </dependencies> ``` And now shade and relocate all packages which conflicts with your own application: ```xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <relocations> <relocation> <pattern>org.joda</pattern> <shadedPattern>fr.pilato.thirdparty.joda</shadedPattern> </relocation> </relocations> </configuration> </execution> </executions> </plugin> </plugins> </build> ``` You can create now a shaded version of elasticsearch + shield by running `mvn clean install`. In your project, you can now depend on: ```xml <dependency> <groupId>fr.pilato.elasticsearch.test</groupId> <artifactId>es-shaded</artifactId> <version>1.0-SNAPSHOT</version> </dependency> <dependency> <groupId>joda-time</groupId> <artifactId>joda-time</artifactId> <version>2.1</version> </dependency> ``` Build then your TransportClient as usual: ```java TransportClient client = TransportClient.builder() .settings(Settings.builder() .put("path.home", ".") .put("shield.user", "username:password") .put("plugin.types", "org.elasticsearch.shield.ShieldPlugin") ) .build(); client.addTransportAddress(new InetSocketTransportAddress(new InetSocketAddress("localhost", 9300))); // Index some data client.prepareIndex("test", "doc", "1").setSource("foo", "bar").setRefresh(true).get(); SearchResponse searchResponse = client.prepareSearch("test").get(); ``` If you want to use your own version of Joda, then import for example `org.joda.time.DateTime`. If you want to access to the shaded version (not recommended though), import `fr.pilato.thirdparty.joda.time.DateTime`. You can run a simple test to make sure that both classes can live together within the same JVM: ```java CodeSource codeSource = new org.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource(); System.out.println("unshaded = " + codeSource); codeSource = new fr.pilato.thirdparty.joda.time.DateTime().getClass().getProtectionDomain().getCodeSource(); System.out.println("shaded = " + codeSource); ``` It will print: ``` unshaded = (file:/path/to/joda-time-2.1.jar <no signer certificates>) shaded = (file:/path/to/es-shaded-1.0-SNAPSHOT.jar <no signer certificates>) ``` This PR also removes fully-loaded module. By the way, the project can now build with Maven 3.3.3 so we can relax a bit our maven policy.
2015-09-01 12:54:52 -04:00
<!-- Embedded components in any distribution -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>com.spatial4j</groupId>
<artifactId>spatial4j</artifactId>
</dependency>
<dependency>
<groupId>com.vividsolutions</groupId>
<artifactId>jts</artifactId>
</dependency>
<!-- needed for templating -->
<dependency>
<groupId>com.github.spullara.mustache.java</groupId>
<artifactId>compiler</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>apache-log4j-extras</artifactId>
</dependency>
<!-- we intentionally do not want slf4j in the distro by default, we use log4j
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
-->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<!-- We copy libs for deb and rpm -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<!-- Many of the modules in this build have the artifactId "elasticsearch"
which break importing into Eclipse without this. -->
<projectNameTemplate>[groupId].[artifactId]</projectNameTemplate>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<!-- checks integration test scratch area (where we extract the distribution) -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/bin</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../src/main/resources/bin</directory>
<filtering>true</filtering>
<excludes>
<exclude>*.exe</exclude>
</excludes>
</resource>
<resource>
<directory>${project.basedir}/../src/main/resources/bin</directory>
<filtering>false</filtering>
<includes>
<include>*.exe</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Packaging: mvn install renames artifacts when copying This PR: * renames all distribution artifacts to `elasticsearch` so maven plugins will pick up the correct finalName without needing any hack. * changes the groupId for every single distribution module as we can't have more than one module using the same groupId:artifactId * does not attach anymore empty jar files for tar/zip/... modules as they don't contain any `src/main/java` stuff. When you build it, you end up with: ``` $ tree ~/.m2/repository/org/elasticsearch/distribution distribution ├── deb │   └── elasticsearch │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb.md5 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.deb.sha1 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1 ├── elasticsearch-distribution │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   └── elasticsearch-distribution-2.0.0-beta1-SNAPSHOT.pom.sha1 ├── fully-loaded │   └── elasticsearch │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1 ├── rpm │   └── elasticsearch │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm.md5 │   │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.rpm.sha1 ├── shaded │   └── elasticsearch │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar.md5 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.jar.sha1 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1 ├── tar │   └── elasticsearch │   ├── 2.0.0-beta1-SNAPSHOT │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1 │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz │   │   ├── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz.md5 │   │   └── elasticsearch-2.0.0-beta1-SNAPSHOT.tar.gz.sha1 └── zip └── elasticsearch └── 2.0.0-beta1-SNAPSHOT    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.md5    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.pom.sha1    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip.md5    ├── elasticsearch-2.0.0-beta1-SNAPSHOT.zip.sha1       └── ``` Closes #12536
2015-08-04 06:30:39 -04:00
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<!-- distribution modules don't provide any jar. No need to upload empty jars to maven central -->
<skipIfEmpty>true</skipIfEmpty>
</configuration>
</plugin>
<plugin>
<groupId>com.carrotsearch.randomizedtesting</groupId>
<artifactId>junit4-maven-plugin</artifactId>
<executions>
<execution>
<id>integ-tests</id>
<configuration>
<!-- currently only 1 cpu works, because integ tests don't make "unique" test directories? -->
<parallelism>1</parallelism>
<systemProperties>
<!-- use external cluster -->
Fix network binding for ipv4/ipv6 When elasticsearch is configured by interface (or default: loopback interfaces), bind to all addresses on the interface rather than an arbitrary one. If the publish address is not specified, default it from the bound addresses based on the following sort ordering: * ipv4/ipv6 (java.net.preferIPv4Stack, defaults to true) * ordinary addresses * site-local addresses * link local addresses * loopback addresses One one address is published, and multicast is still always over ipv4: these need to be future improvements. Closes #12906 Closes #12915 Squashed commit of the following: commit 7e60833312f329a5749f9a256b9c1331a956d98f Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 14:45:33 2015 -0400 fix java 7 compilation oops commit c7b9f3a42058beb061b05c6dd67fd91477fd258a Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 14:24:16 2015 -0400 Cleanup/fix logic around custom resolvers commit bd7065f1936e14a29c9eb8fe4ecab0ce512ac08e Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 13:29:42 2015 -0400 Add some unit tests for utility methods commit 0faf71cb0ee9a45462d58af3d1bf214e8a79347c Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 12:11:48 2015 -0400 localhost all the way down commit e198bb2bc0d1673288b96e07e6e6ad842179978c Merge: b55d092 b93a75f Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 12:05:02 2015 -0400 Merge branch 'master' into network_cleanup commit b55d092811d7832bae579c5586e171e9cc1ebe9d Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 12:03:03 2015 -0400 fix docs, fix another bug in multicast (publish host = bad here!) commit 88c462eb302b30a82585f95413927a5cbb7d54c4 Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 11:50:49 2015 -0400 remove nocommit commit 89547d7b10d68b23d7f24362e1f4782f5e1ca03c Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 11:49:35 2015 -0400 fix http too commit 9b9413aca8a3f6397b5031831f910791b685e5be Author: Robert Muir <rmuir@apache.org> Date: Mon Aug 17 11:06:02 2015 -0400 Fix transport / interface code Next up: multicast and then http
2015-08-17 15:37:07 -04:00
<tests.cluster>localhost:${integ.transport.port}</tests.cluster>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>tar</module>
<module>zip</module>
<module>deb</module>
</modules>
<profiles>
<!--
We include automatically RPM module when it's available in common locations.
If your rpmbuild is in another location (but in path), run maven with rpm profile:
mvn deploy -Prpm
-->
<profile>
<id>macos_brew</id>
<activation>
<file>
<!-- Folks having /usr/local/bin/rpmbuild available will be able to build the rpm module -->
<exists>/usr/local/bin/rpmbuild</exists>
</file>
</activation>
<modules>
<module>rpm</module>
</modules>
</profile>
<profile>
<id>rpm</id>
<activation>
<file>
<!-- Folks having /usr/bin/rpmbuild available will be able to build the rpm module -->
<exists>/usr/bin/rpmbuild</exists>
</file>
</activation>
<modules>
<module>rpm</module>
</modules>
</profile>
</profiles>
</project>