2015-06-03 04:39:31 -04:00
|
|
|
<?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.distribution</groupId>
|
2015-08-14 11:18:21 -04:00
|
|
|
<artifactId>distributions</artifactId>
|
2015-09-03 04:43:28 -04:00
|
|
|
<version>3.0.0-SNAPSHOT</version>
|
2015-06-03 04:39:31 -04:00
|
|
|
</parent>
|
|
|
|
|
2015-08-04 06:30:39 -04:00
|
|
|
<groupId>org.elasticsearch.distribution.deb</groupId>
|
|
|
|
<artifactId>elasticsearch</artifactId>
|
2015-08-14 11:18:21 -04:00
|
|
|
<name>Distribution: Deb</name>
|
2015-08-04 06:30:39 -04:00
|
|
|
<!--
|
|
|
|
We should use deb packaging here because we don't want to publish any jar.
|
|
|
|
But if you do this, then maven lifecycle does not execute any test (nor compile any test)
|
|
|
|
-->
|
|
|
|
<!--packaging>deb</packaging-->
|
2015-08-10 08:18:39 -04:00
|
|
|
<description>The Debian distribution of Elasticsearch</description>
|
2015-06-03 04:39:31 -04:00
|
|
|
|
|
|
|
<properties>
|
|
|
|
<deb.sign>false</deb.sign>
|
|
|
|
<deb.sign.method>dpkg-sig</deb.sign.method>
|
|
|
|
</properties>
|
|
|
|
|
|
|
|
<build>
|
|
|
|
|
|
|
|
<filters>
|
|
|
|
<filter>${project.basedir}/src/main/packaging/packaging.properties</filter>
|
|
|
|
</filters>
|
|
|
|
|
|
|
|
<plugins>
|
|
|
|
<plugin>
|
|
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
|
|
<artifactId>maven-resources-plugin</artifactId>
|
|
|
|
<executions>
|
|
|
|
<!-- Filters some files and uses packaging.properties when building the .deb package -->
|
|
|
|
<execution>
|
|
|
|
<id>copy-resources-deb</id>
|
|
|
|
<phase>prepare-package</phase>
|
|
|
|
<goals>
|
|
|
|
<goal>copy-resources</goal>
|
|
|
|
</goals>
|
|
|
|
<configuration>
|
|
|
|
<outputDirectory>${project.build.directory}/generated-packaging/deb/</outputDirectory>
|
|
|
|
<filters>
|
|
|
|
<filter>${project.basedir}/../src/main/packaging/packaging.properties</filter>
|
|
|
|
<filter>${project.basedir}/src/main/packaging/packaging.properties</filter>
|
|
|
|
</filters>
|
|
|
|
<resources>
|
|
|
|
<resource>
|
|
|
|
<directory>${project.basedir}/../src/main/packaging/</directory>
|
|
|
|
<filtering>true</filtering>
|
|
|
|
<includes>
|
|
|
|
<include>**/*</include>
|
|
|
|
</includes>
|
|
|
|
<excludes>
|
|
|
|
<exclude>packaging.properties</exclude>
|
|
|
|
</excludes>
|
|
|
|
</resource>
|
|
|
|
<resource>
|
|
|
|
<directory>${project.basedir}/src/main/packaging/</directory>
|
|
|
|
<filtering>true</filtering>
|
|
|
|
<includes>
|
|
|
|
<include>**/*</include>
|
|
|
|
</includes>
|
|
|
|
<excludes>
|
|
|
|
<exclude>packaging.properties</exclude>
|
|
|
|
</excludes>
|
|
|
|
</resource>
|
|
|
|
<resource>
|
|
|
|
<directory>${project.basedir}/../src/main/resources</directory>
|
|
|
|
<filtering>true</filtering>
|
|
|
|
<includes>
|
|
|
|
<include>bin/elasticsearch</include>
|
|
|
|
<include>bin/elasticsearch.in.sh</include>
|
|
|
|
<include>bin/plugin</include>
|
2015-09-24 11:39:00 -04:00
|
|
|
<include>bin/elasticsearch-systemd-pre-exec</include>
|
2015-06-03 04:39:31 -04:00
|
|
|
</includes>
|
|
|
|
</resource>
|
|
|
|
</resources>
|
|
|
|
</configuration>
|
|
|
|
</execution>
|
|
|
|
</executions>
|
|
|
|
</plugin>
|
|
|
|
|
|
|
|
<plugin>
|
|
|
|
<!-- some infos https://github.com/tcurdt/jdeb/blob/master/docs/maven.md -->
|
|
|
|
<artifactId>jdeb</artifactId>
|
|
|
|
<groupId>org.vafer</groupId>
|
|
|
|
<configuration>
|
|
|
|
<!-- By default it should generates target/${artifactId}_${version}.deb but we get elasticsearch_2.0.0~SNAPSHOT_all.deb -->
|
|
|
|
<deb>${project.build.directory}/releases/elasticsearch-${project.version}.deb</deb>
|
|
|
|
<controlDir>${project.build.directory}/generated-packaging/deb/scripts</controlDir>
|
|
|
|
</configuration>
|
|
|
|
<executions>
|
|
|
|
<execution>
|
|
|
|
<phase>package</phase>
|
|
|
|
<goals>
|
|
|
|
<goal>jdeb</goal>
|
|
|
|
</goals>
|
|
|
|
<configuration>
|
|
|
|
<signPackage>${deb.sign}</signPackage>
|
|
|
|
<keyring>${gpg.keyring}</keyring>
|
|
|
|
<key>${gpg.key}</key>
|
|
|
|
<passphrase>${gpg.passphrase}</passphrase>
|
|
|
|
<signMethod>${deb.sign.method}</signMethod>
|
|
|
|
<dataSet>
|
|
|
|
<!-- Add bin directory -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/bin</src>
|
|
|
|
<type>directory</type>
|
2015-09-24 11:39:00 -04:00
|
|
|
<includes>elasticsearch,elasticsearch.in.sh,plugin,elasticsearch-systemd-pre-exec</includes>
|
2015-06-03 04:39:31 -04:00
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>${packaging.elasticsearch.bin.dir}</prefix>
|
|
|
|
<filemode>755</filemode>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
2015-10-08 04:43:38 -04:00
|
|
|
<!-- create the conf dir manually so it gets proper permissions -->
|
|
|
|
<data>
|
|
|
|
<type>template</type>
|
|
|
|
<paths>
|
|
|
|
<path>${packaging.elasticsearch.conf.dir}</path>
|
|
|
|
</paths>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<filemode>750</filemode>
|
|
|
|
<user>root</user>
|
|
|
|
<group>elasticsearch</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
2015-06-03 04:39:31 -04:00
|
|
|
<!-- Add configuration files -->
|
|
|
|
<data>
|
|
|
|
<src>${project.basedir}/../src/main/resources/config</src>
|
|
|
|
<type>directory</type>
|
|
|
|
<excludes>.DS_Store</excludes>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>${packaging.elasticsearch.conf.dir}</prefix>
|
2015-10-08 04:43:38 -04:00
|
|
|
<filemode>750</filemode>
|
2015-06-03 04:39:31 -04:00
|
|
|
<user>root</user>
|
2015-10-08 04:43:38 -04:00
|
|
|
<group>elasticsearch</group>
|
2015-06-03 04:39:31 -04:00
|
|
|
</mapper>
|
|
|
|
</data>
|
2015-08-06 15:03:59 -04:00
|
|
|
<data>
|
|
|
|
<type>template</type>
|
|
|
|
<paths>
|
|
|
|
<path>${packaging.elasticsearch.conf.dir}/scripts</path>
|
|
|
|
</paths>
|
2015-10-08 04:43:38 -04:00
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<filemode>750</filemode>
|
|
|
|
<user>root</user>
|
|
|
|
<group>elasticsearch</group>
|
|
|
|
</mapper>
|
2015-08-06 15:03:59 -04:00
|
|
|
</data>
|
2015-06-03 04:39:31 -04:00
|
|
|
<!-- Add environment vars file -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/env/elasticsearch</src>
|
|
|
|
<type>file</type>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>/etc/default</prefix>
|
|
|
|
<filemode>644</filemode>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<!-- Add libs -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/</src>
|
|
|
|
<includes>elasticsearch-${project.version}.jar</includes>
|
|
|
|
<type>directory</type>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>${packaging.elasticsearch.home.dir}/lib</prefix>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/../target/lib</src>
|
[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
|
|
|
<excludes>${project.build.finalName}-sources.jar,${project.build.finalName}-tests.jar,${project.build.finalName}-test-sources.jar,slf4j-api-*.jar</excludes>
|
2015-06-03 04:39:31 -04:00
|
|
|
<type>directory</type>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>${packaging.elasticsearch.home.dir}/lib</prefix>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<!-- Add init.d files -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/init.d/</src>
|
|
|
|
<type>directory</type>
|
|
|
|
<excludes>.DS_Store</excludes>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>/etc/init.d</prefix>
|
|
|
|
<filemode>755</filemode>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<!-- Adds systemd file -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/systemd/elasticsearch.service</src>
|
|
|
|
<dst>${packaging.elasticsearch.systemd.dir}/elasticsearch.service</dst>
|
|
|
|
<type>file</type>
|
|
|
|
</data>
|
|
|
|
<!-- Adds systemd/sysctl.d configuration file -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/systemd/sysctl/elasticsearch.conf</src>
|
|
|
|
<dst>${packaging.elasticsearch.systemd.sysctl.dir}/elasticsearch.conf</dst>
|
|
|
|
<type>file</type>
|
|
|
|
</data>
|
|
|
|
<!-- Adds systemd/tmpfiles.d configuration file -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/systemd/elasticsearch.conf</src>
|
|
|
|
<dst>${packaging.elasticsearch.tmpfilesd.dir}/elasticsearch.conf</dst>
|
|
|
|
<type>file</type>
|
|
|
|
</data>
|
|
|
|
<!-- Add lintian files -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/lintian</src>
|
|
|
|
<type>directory</type>
|
|
|
|
<excludes>.DS_Store</excludes>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>/usr/share/lintian/overrides</prefix>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<!-- Add readme files -->
|
|
|
|
<data>
|
|
|
|
<src>${project.basedir}/../src/main/resources/</src>
|
|
|
|
<includes>*.txt, *.textile</includes>
|
|
|
|
<excludes>LICENSE.txt, .DS_Store</excludes>
|
|
|
|
<type>directory</type>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<prefix>${packaging.elasticsearch.home.dir}</prefix>
|
|
|
|
<user>root</user>
|
|
|
|
<group>root</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
<!-- Add license files -->
|
|
|
|
<data>
|
|
|
|
<src>${project.build.directory}/generated-packaging/deb/copyright</src>
|
|
|
|
<dst>/usr/share/doc/elasticsearch/copyright</dst>
|
|
|
|
<type>file</type>
|
|
|
|
</data>
|
|
|
|
<!-- Adds and sets permission on default directories -->
|
|
|
|
<data>
|
|
|
|
<type>template</type>
|
|
|
|
<paths>
|
|
|
|
<path>${packaging.elasticsearch.data.dir}</path>
|
|
|
|
<path>${packaging.elasticsearch.log.dir}</path>
|
|
|
|
<path>${packaging.elasticsearch.plugins.dir}</path>
|
|
|
|
<path>${packaging.elasticsearch.pid.dir}</path>
|
|
|
|
</paths>
|
|
|
|
<mapper>
|
|
|
|
<type>perm</type>
|
|
|
|
<dirmode>755</dirmode>
|
|
|
|
<user>${packaging.elasticsearch.user}</user>
|
|
|
|
<group>${packaging.elasticsearch.group}</group>
|
|
|
|
</mapper>
|
|
|
|
</data>
|
|
|
|
</dataSet>
|
|
|
|
|
|
|
|
</configuration>
|
|
|
|
</execution>
|
|
|
|
</executions>
|
|
|
|
</plugin>
|
2015-08-04 06:30:39 -04:00
|
|
|
|
2015-06-03 04:39:31 -04:00
|
|
|
<plugin>
|
|
|
|
<groupId>org.apache.maven.plugins</groupId>
|
|
|
|
<artifactId>maven-antrun-plugin</artifactId>
|
|
|
|
<executions>
|
2015-07-29 21:34:46 -04:00
|
|
|
<!-- start up external cluster -->
|
|
|
|
<execution>
|
|
|
|
<id>integ-setup</id>
|
|
|
|
<phase>pre-integration-test</phase>
|
|
|
|
<goals>
|
|
|
|
<goal>run</goal>
|
|
|
|
</goals>
|
|
|
|
<configuration>
|
|
|
|
<skip>${skip.integ.tests}</skip>
|
|
|
|
<target>
|
2015-08-06 14:48:27 -04:00
|
|
|
<ant antfile="${elasticsearch.integ.antfile}" target="start-external-cluster-deb">
|
|
|
|
<property name="tests.jvm.argline" value="${tests.jvm.argline}"/>
|
|
|
|
</ant>
|
2015-07-29 21:34:46 -04:00
|
|
|
</target>
|
|
|
|
</configuration>
|
|
|
|
</execution>
|
|
|
|
<!-- shut down external cluster -->
|
|
|
|
<execution>
|
|
|
|
<id>integ-teardown</id>
|
|
|
|
<phase>post-integration-test</phase>
|
|
|
|
<goals>
|
|
|
|
<goal>run</goal>
|
|
|
|
</goals>
|
|
|
|
<configuration>
|
|
|
|
<skip>${skip.integ.tests}</skip>
|
|
|
|
<target>
|
|
|
|
<ant antfile="${elasticsearch.integ.antfile}" target="stop-external-cluster"/>
|
|
|
|
</target>
|
|
|
|
</configuration>
|
|
|
|
</execution>
|
2015-06-03 04:39:31 -04:00
|
|
|
</executions>
|
|
|
|
</plugin>
|
|
|
|
</plugins>
|
|
|
|
</build>
|
2015-07-29 21:34:46 -04:00
|
|
|
|
|
|
|
<profiles>
|
|
|
|
<!-- we run integration test with real dpkg utils, you must have them -->
|
|
|
|
<profile>
|
|
|
|
<id>has_dpkg</id>
|
|
|
|
<activation>
|
|
|
|
<file><missing>/usr/bin/dpkg-deb</missing></file>
|
|
|
|
</activation>
|
|
|
|
<properties>
|
|
|
|
<skip.integ.tests>true</skip.integ.tests>
|
|
|
|
</properties>
|
|
|
|
</profile>
|
|
|
|
</profiles>
|
2015-06-03 04:39:31 -04:00
|
|
|
</project>
|