Giter VIP home page Giter VIP logo

elasticsearch-maven-plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elasticsearch-maven-plugin's Issues

Add non-daemon/fork mode goal to stay running until manually stopped

This plugin is fantastic for starting and stopping ES during the build; thank you for it!

Due to the fast lather-rinse-repeat cycle of test creation/modification and app code creation/modification, keeping the server running for developing and manually testing (e.g. running a specific test) would reduce the cycle time.

I would like to use this plugin for that too, keeping the config with one setup for development and automated tests. Adding an option to manually start the server and stay running until manually stopped (with the stop goal or Ctrl-c the console) would accomplish this; perhaps a "run" goal in addition to "runforked" would work?

I can start plugin blocking execution

Use-Case

when I develop integration tests and want to debug them, I want to run plugin in blocking manner in order not to have to restart ES all the time, or run full maven clean verify cycle.

AT

  • given
    • plugin has a run mojo
  • when
    • I execute run goal
  • then
    • ES instance is started with configuration values specified for the plugin
    • ES instance is blocking and waits for requests

Failed to obtain node locks when running in TravisCI

Hi.

The build process is working without any problems in my locally but fails in TravisCI.

The Build

[2017-12-04T13:24:40,213][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to obtain node locks, tried [[/home/travis/build/hakdogan/ElasticSearch/target/elasticsearch0/data/test]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:136) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:123) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:70) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:134) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.6.4.jar:5.6.4]
Caused by: java.lang.IllegalStateException: failed to obtain node locks, tried [[/home/travis/build/hakdogan/ElasticSearch/target/elasticsearch0/data/test]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:261) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.node.Node.<init>(Node.java:265) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.node.Node.<init>(Node.java:245) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:233) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:342) ~[elasticsearch-5.6.4.jar:5.6.4]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:132) ~[elasticsearch-5.6.4.jar:5.6.4]
	... 6 more

travis.yml

language: java
jdk:
- oraclejdk8
sudo: true
script: mvn clean install

before_script:
  - sudo sysctl -w vm.max_map_count=262144

after_success:
- mvn clean cobertura:cobertura coveralls:report

deploy:
  provider: releases
  skip_cleanup: true

  on:
    tags: true
    all_branches: true
    repo: hakdogan/ElasticSearch

pom.xml

<plugin>
                <groupId>com.github.alexcojocaru</groupId>
                <artifactId>elasticsearch-maven-plugin</artifactId>
                <version>6.0</version>
                <configuration>
                    <version>5.6.4</version>
                    <clusterName>test</clusterName>
                    <transportPort>9300</transportPort>
                    <httpPort>9200</httpPort>
                    <timeout>120</timeout>
                </configuration>
                <executions>
                    <execution>
                        <id>run</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>runforked</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>start-elasticsearch</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>runforked</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop-elasticsearch</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

I haven't found anything like this between the issues. The problem seems to be write permission, any idea?

wait Indefinitely

Hi Alex,

Thank you for the plugin!

I am trying to pass the -DwaitIndefinitely but it is not working. What am i missing.

mvn clean verify -DwaitIndefinitely

Skip an execution

Is there any way that this plugin can support skipping the execution? I'm thinking along the lines of something like in the snippet below.

<plugin>
    <groupId>com.github.alexcojocaru</groupId>
    <artifactId>elasticsearch-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <clusterName>test</clusterName>
        <tcpPort>9300</tcpPort>
        <httpPort>9200</httpPort>
        <skip>${skip.elasticSearch}</skip>
    </configuration>
    <execution>
        ...
    </execution>
</plugin>

There doesn't seem to be anything that will allow this to skip. It can be a part of the configuration for any execution as well. Thank you.

Allow to redirect log to file

  • given
    • I run forked plugin execution
  • when
    • I specify log path parameter
  • then
    • com.github.alexcojocaru.mojo.elasticsearch.v2.AbstractElasticsearchBaseMojo#getLog is returning file based logger

Right now plugin is always writing to the console log, would be nice to configure it somehow.

Permission denied on Travis with ES 6.4

I am trying to switch from Elasticsearch version 6.2 to 6.4.
However, I now get the following error when launching Elasticsearch 6.4 on Travis:

[INFO] Installing /tmp/elasticsearch-oss-6.4.0.zip to /home/travis/.m2/repository/com/github/alexcojocaru/elasticsearch-oss/6.4.0/elasticsearch-oss-6.4.0.zip
[INFO] Elasticsearch[0]: Executing command '[chmod, 755, bin/elasticsearch-plugin]' in directory '/home/travis/build/kizombaDev/EventStudio/event-common/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[sed, -i, -e, 1s:.*:#!/usr/bin/env bash:, bin/elasticsearch-plugin]' in directory '/home/travis/build/kizombaDev/EventStudio/event-common/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch-plugin, list]' in directory '/home/travis/build/kizombaDev/EventStudio/event-common/target/elasticsearch0' bin/elasticsearch-plugin: line 3: bin/elasticsearch-cli: Permission denied

Everything worked fine with ES 6.2 ...
Am I doing something wrong or is this possibly a bug?

Let me know if you need further information

Build fails on Windows

It is impossible to build the plugin on a Windows system:

  1. BootstrapClusterStepTest fails due to path separator differences ('\' vs '/').

  2. taskkill /F forcibly kills the ES instance and leaves the pid file around. Subsequent isAlive checks fail.

How to set Elasticsearch version.

According to the README <version> is used to set Elasticsearch version. Default "5.0.0". However, setting version to 5.0.0 causes a maven error.
[ERROR] Plugin com.github.alexcojocaru:elasticsearch-maven-plugin:5.0.0 or one of its dependencies could not be resolved: Failure to find com.github.alexcojocaru:elasticsearch-maven-plugin:jar:5.0.0 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

That message makes it sound like sets the elasticsearch-maven-plugin version, not the Elasticsearch version. Indeed, values of 5.5 or 5.9 work just fine even though there currently is no version 5.9 of Elasticsearch.

On the other hand, no matter what I set in <version> I always see Elasticsearch 5.0.0 launched. I want to launch ES 5.5.0. How do I do that?

Cannot run inside of docker due to user permissions

Semi related to #68

When attempting to run inside of a docker container, the following is returned from a maven verify:

[2018-09-19T23:52:52,197][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

While elasticsearch surely shouldn't run as root in a typical environment, is it not possible to override the user attribute for this to account for things like containers where the typical POSIX model is not necessarily at play, at the very least for unit/integration tests?

Cannot run program /pid

When integration tests stop, plugin throws the following exception:

[INFO] [INFO] --- jetty-maven-plugin:8.1.3.v20120416:stop (stop-jetty) @ --- [INFO] Stopping server 0 [INFO] --- elasticsearch-maven-plugin:5.0:stop (stop-elasticsearch) @ --- [INFO] Stopping Elasticsearch [com.github.alexcojocaru.mojo.elasticsearch.v2.InstanceConfiguration@34d6bca6[id=0,baseDir=D:\work\...\target\elasticsearch0,httpPort=0,transportPort=0,pathData=<null>,pathLogs=<null>]] [ERROR] Exception while stopping Elasticsearch java.io.IOException: Cannot run program "/pid" (in directory "D:\work\...\target\elasticsearch0"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) at com.github.alexcojocaru.mojo.elasticsearch.v2.StopMojo.execute(StopMojo.java:50) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286) at org.apache.maven.cli.MavenCli.main(MavenCli.java:197) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 16:35Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ... 23 more

Windows 7x64.

What is the cause of that? Thanks.

Elasticsearch version 2 unable to start instance

Hello,

Unfortunately, our prod env is running elastic search version 2.4.1. So, I am trying to use version 2 of this plugin.

But, when I try - mvn elasticsearch:start it doesnt seem to load the Init script and also, doesnt seem to start the elasticsearch instance.

IRV-MNAMJOSH-7D:mtd mnamjoshi$ mvn elasticsearch:start
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building java-metadata 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- elasticsearch-maven-plugin:2.0:start (default-cli) @ java-metadata ---
log4j:WARN No appenders could be found for logger (org.elasticsearch.node).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.882 s
[INFO] Finished at: 2018-05-24T22:26:05-07:00
[INFO] Final Memory: 22M/309M
[INFO] ------------------------------------------------------------------------
IRV-MNAMJOSH-7D:mtd mnamjoshi

Following is the snippet from my pom.xml -

com.github.alexcojocaru elasticsearch-maven-plugin 2.0
					<configuration>
    					<!-- REPLACE THE FOLLOWING WITH THE ELASTICSEARCH VERSION YOU NEED -->
    					<version>2.0.0</version>
    					<clusterName>mtd</clusterName>
    					<transportPort>9300</transportPort>
    					<httpPort>9200</httpPort>
    					<tcpPort>9300</tcpPort>
    					<setAwait>true</setAwait>
    					<pathInitScript>src/test/resources/elasticsearch/Init.script</pathInitScript>
					</configuration>
					<dependencies>
						<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12 -->
						<dependency>
							<groupId>org.slf4j</groupId>
							<artifactId>slf4j-log4j12</artifactId>
							<version>1.7.25</version>
						</dependency>
					</dependencies>
					<executions>
    					<!--
        					The elasticsearch maven plugin goals are by default bound to the
        					pre-integration-test and post-integration-test phases
   						-->
    					<execution>
        					<id>start-elasticsearch</id>
        					<phase>pre-integration-test</phase>
        					<goals>
            					<goal>runforked</goal>
        					</goals>
    					</execution>
    					<execution>
        					<id>stop-elasticsearch</id>
        					<phase>post-integration-test</phase>
        					<goals>
            					<goal>stop</goal>
        					</goals>
    					</execution>
					</executions>
				</plugin>

Thank you

Sincerely,
Manjiri

Document how to contribute and run tests

Hey

I'm on my way to submit a PR for #42 but I have hard time to understand how to run the test I added to test the new feature I added.
So I'm running for now a mvn clean install every time but it's far from being optimal as I'm spending most of the time running the other integration tests.

Could you document how to create tests (well, I copy and paste for now so I should be good) but give some tricks on how to actually run a single test?

Also, everything you put in src/it is preprocessed by Groovy if I understand correctly. Is there a best practice to write a pom.xml example (and a java test) which you can easily run from the IDE?

Best!

Groovy support ?

Hello,

how can i enable the groovy support in the elasticsearch ?

<dependencies>
                    <dependency>
                        <groupId>org.elasticsearch</groupId>
                        <artifactId>elasticsearch</artifactId>
                        <!-- REPLACE THE FOLLOWING WITH THE VERSION OF YOUR DESIRE -->
                        <version>${elasticsearch.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.elasticsearch.module</groupId>
                        <artifactId>lang-groovy</artifactId>
                        <version>${elasticsearch.version}</version>
                    </dependency>
                </dependencies>

i add this as a dependency but this is not working.

Thanks for your help

Using ${build.directory} in the configPath

I am using the plugin inside of a submodule project, so I need to specify the config folder using one of the maven properties.
Something like this:

                <configuration>
                    <clusterName>idx-integrationtest-cluster</clusterName>
                    <tcpPort>9399</tcpPort>
                    <httpPort>9299</httpPort>
                    <configPath>${build.directory}/src/test/resources/es_config</configPath>
                </configuration>

But looks like ${build.directory} is not supported inside of the configPath.
How to do it?

Regards.

Memory Issue when starting

Hi!

Environment: Windows 7

Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Exception in thread "Thread-1" java.lang.IllegalStateException: This Elasticsearch process destroyer does not support this operation
    at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.remove(ForkedElasticsearchProcessDestroyer.java:68)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:411)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
    at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:109)
    at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedInstance.run(ForkedInstance.java:39)
    at java.lang.Thread.run(Thread.java:748)
[DEBUG] Waiting  up to 30s for Elasticsearch to start ...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:38 min
[INFO] Finished at: 2017-10-20T11:19:45+03:00
[INFO] Final Memory: 28M/67M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.10:runforked (start-elasticsearch) on project mrc-credit-limit: Condition returned by method "waitToStart" in class com.github.alexcojocaru.mojo.elasticsearch.v2.client.Monitor was not fulfilled within 30 seconds. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] The Elasticsearch process has already stopped. Nothing to clean up

Process finished with exit code 1

pom.xml

<plugin>
	<groupId>com.github.alexcojocaru</groupId>
	<artifactId>elasticsearch-maven-plugin</artifactId>
	<version>5.10</version>
	<configuration>
		<clusterName>creditlimit</clusterName>
		<transportPort>9300</transportPort>
		<httpPort>9200</httpPort>
		<version>5.5.2</version>
	</configuration>
	<executions>
		<execution>
			<id>start-elasticsearch</id>
			<phase>compile</phase>
			<goals>
				<goal>runforked</goal>
			</goals>
		</execution>
		<execution>
			<id>stop-elasticsearch</id>
			<phase>prepare-package</phase>
			<goals>
				<goal>stop</goal>
			</goals>
		</execution>
	</executions>
</plugin>

JUnit integration

thanks for this plugin!

How do I run integration tests with JUnit against a this test ES instance?

Wrong URL when downloading elasticsearch?

I'm seeing this in logs when downloading a new elasticsearch version (6.3+):

Downloading from elastic-download-service: https://artifacts.elastic.co/maven/com/github/alexcojocaru/elasticsearch/6.3.1/elasticsearch-6.3.1.zip
Downloading from central: https://repo.maven.apache.org/maven2/com/github/alexcojocaru/elasticsearch/6.3.1/elasticsearch-6.3.1.zip

The elastic-download-service URL sounds wrong to me. Is that an issue or something you did on purpose?

unable to create multi-node ES cluster

I am trying to create some tests which require multiple nodes to belong to the same cluster using the elasticsearch-maven-plugin.

I tried setting the instanceCount to 2 in the pom.xml file and running mvn verify I am seeing two instances of ES created on port 9400 and 9401. However, when I query them for stats only a single node is reported:

curl -XGET http://localhost:9400/_nodes?pretty
...
  "_nodes" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  }
...

and same thing when I do curl -XGET http://localhost:9401/_nodes?pretty.

What I am trying to achieve is to see was "total" : 2 for the node count in this cluster.

I realize that the instanceCount option generates two separate elasticsearch instances, but is there a way to connect them so that they're part of the same cluster?

Whatever files get created by the plugin are transient. Even changing the elasticsearch.yml files in an attempt to create a cluster gets overwritten next time mvn verify is run.

Not working for Elastic Search Java High Level Rest Client

Hi, We were using this dependency for testing Integration test cases. Recently we upgraded from Transport Client to High Level Client. After this migration, this is not working, getting Connection Refused.

So could you support for High Rest Client ?

Init script has not very convinient format.

Init script has not very convinient format. I mean, that for now, it is parsed right if a command is in one line, which is not very convinient when you have big mapping or record. Do you plan to make it more convinient?

Thanks.

Override Xms, Xmx

Is it possible to override the default xms and xmx arguments of Elasticsearch?

[INFO ][o.e.n.Node ] JVM arguments [-Xms2g, -Xmx2g,...]

No implementation for org.eclipse.aether.RepositorySystem was bound. while locating org.apache.maven.artifact.resolver.DefaultArtifactResolver

I am using object of ArtifactResolver in my junit test class in following way
final ArtifactResolver resolver = (ArtifactResolver)this .getContainer().lookup(ArtifactResolver.ROLE);

It works find when I am use maven-compat dependency with version 3.0-alpha-2.But, I had to update this dependency version to 3.3.9 to use certain upgraded methods and code. The moment, I upgrade its version, I started getting following error in my eclipse and jenkins central both

No implementation for org.eclipse.aether.RepositorySystem was bound. while locating org.apache.maven.artifact.resolver.DefaultArtifactResolver at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.MergedModule -> org.eclipse.sisu.plexus.PlexusBindingModule) at ClassRealm[plexus.core, parent: null] (via modules: org.eclipse.sisu.wire.MergedModule -> org.eclipse.sisu.plexus.PlexusBindingModule) while locating org.apache.maven.artifact.resolver.ArtifactResolver1 error role: org.apache.maven.artifact.resolver.ArtifactResolver roleHint: at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:243) at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:237) at com.cwsoft.plugins.build.artifact.DownloadMojoTest.init(DownloadMojoTest.java:124) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:168) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37) at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: com.google.inject.ProvisionException: Unable to provision, see the following errors:

Maven version that I am using is maven 3.3.9.

OSX 10.13.6: Error: Could not find or load main class

After adding and configuring the plugin, when trying to run the project containing it, we get the next error:

[INFO] Using Elasticsearch [0] configuration: com.github.alexcojocaru.mojo.elasticsearch.v2.InstanceConfiguration@2bef09c0[id=0,baseDir=/myproject/target/elasticsearch0,httpPort=9200,transportPort=9300,pathData=<null>,pathLogs=<null>,settings=<null>]
[INFO] Elasticsearch[0]: Executing command '[chmod, 755, bin/elasticsearch-plugin]' in directory '/myproject/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[sed, -i, -e, 1s:.*:#!/usr/bin/env bash:, bin/elasticsearch-plugin]' in directory '/myproject/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch-plugin, list]' in directory '/myproject/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[chmod, 755, bin/elasticsearch]' in directory '/myproject/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[sed, -i, -e, 1s:.*:#!/usr/bin/env bash:, bin/elasticsearch]' in directory '/myproject/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch, -p, pid, -Ecluster.name=esDevCluster, -Ehttp.port=9200, -Etransport.tcp.port=9300, -Ehttp.cors.enabled=true]' in directory '/myproject/target/elasticsearch0'
Error: Could not find or load main class -Xms500m
Exception in thread "Thread-5" java.lang.IllegalStateException: This Elasticsearch process destroyer does not support this operation
	at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.remove(ForkedElasticsearchProcessDestroyer.java:50)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:411)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:222)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:167)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedInstance.run(ForkedInstance.java:42)
	at java.lang.Thread.run(Thread.java:748)

After adding a few debugging messages to the elasticsearch run script and running it directly, we noticed that the final java command is like the next one

/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java -Xms2G -Xmx2G -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/myproject/target/elasticsearch0 -cp /myproject/target/elasticsearch0/lib/* org.elasticsearch.bootstrap.Elasticsearch

Running the previous command directly yields to the exact same error.

However, quoting the -cp parameter value makes it work just fine, like this

/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java -Xms2G -Xmx2G -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+AlwaysPreTouch -server -Xss1m -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djna.nosys=true -Djdk.io.permissionsUseCanonicalPath=true -Dio.netty.noUnsafe=true -Dio.netty.noKeySetOptimization=true -Dio.netty.recycler.maxCapacityPerThread=0 -Dlog4j.shutdownHookEnabled=false -Dlog4j2.disable.jmx=true -Dlog4j.skipJansi=true -XX:+HeapDumpOnOutOfMemoryError -Des.path.home=/myproject/target/elasticsearch0 -cp '/myproject/target/elasticsearch0/lib/*' org.elasticsearch.bootstrap.Elasticsearch

Kind Regards
Juan

The process with PID could not be terminated. The operation attempted is not supported.

Sometimes the ES instance on Windows can't be killed, and the build fails :-(

May be related to an unkillable state.

[INFO] com.github.alexcojocaru.mojo.elasticsearch.v2.ElasticsearchSetupException: Elasticsearch [0]: Cannot execute command '[taskkill, /F, /pid, 12340]' in directory 'C:\Projects\elasticsearch-maven-plugin\target\it\runforked-with-path-conf\target\elasticsearch0'
[INFO] Output:
[INFO]
[INFO] Error:
[INFO] ERROR: The process with PID 12340 could not be terminated.
[INFO] Reason: The operation attempted is not supported.
[INFO]
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:267)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:149)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.terminateWindowsProcess(ForkedElasticsearchProcessDestroyer.java:118)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.terminateProcess(ForkedElasticsearchProcessDestroyer.java:65)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.access$000(ForkedElasticsearchProcessDestroyer.java:15)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer$1.run(ForkedElasticsearchProcessDestroyer.java:28)
[INFO] Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
[INFO]  at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
[INFO]  at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
[INFO]  at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:222)
[INFO]  ... 5 more

Frequent process Termination

Hi,
I've configure plugin as

            <plugin>
                <groupId>com.github.alexcojocaru</groupId>
                <artifactId>elasticsearch-maven-plugin</artifactId>
                <version>5.9</version>
                <configuration>
                    <clusterName>${elasticsearch.clustername}</clusterName>
                    <transportPort>${elasticsearch.tcp.port}</transportPort>
                    <httpPort>${elasticsearch.http.port}</httpPort>
                    <pathConf>${qa.config.dir}/elasticsearch-config</pathConf>
                    <version>5.5.1</version>
                    <timeout>120</timeout>
                    <autoCreateIndex>false</autoCreateIndex>
                    <plugins>
                        <plugin>
                            <uri>analysis-icu</uri>
                        </plugin>
                        <plugin>
                            <uri>file:///${qa.config.dir}/elasticsearch-plugins/analyzed-queries/analyzed-queries-${elasticsearch.version}.0.zip</uri>
                        </plugin>
                    </plugins>
                </configuration>
                <executions>
                    <execution>
                        <id>start-elasticsearch</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>runforked</goal>
                        </goals>
                        <configuration>
                            <pathInitScript>${elasticsearch.loadscript}</pathInitScript>
                            <skip>${skip.elasticsearch}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-elasticsearch</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <skip>${skip.elasticsearch}</skip>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.elasticsearch</groupId>
                        <artifactId>elasticsearch</artifactId>
                        <version>${elasticsearch.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

But while execution, I keep getting failures while executing load scripts

[ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.9:runforked (start-elasticsearch) on project ls-search-qa-features: Execution start-elasticsearch of goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.9:runforked failed: Cannot execute command PUT:company:{"settings":{"analysis":{"char_filter":{"extract_id":{"type":"pattern_replace","pattern":"^.*?\\s?([\\S]+)\\s*$","replacement":"$1"},"add_start_stop_tokens":
....
....
.....
 java.net.SocketTimeoutException: Read timed out -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :ls-search-qa-features
[INFO] Apache ActiveMQ 5.10.0 (localhost, ID:UX000954-TPL-A-61745-1502096948112-0:1) is shutting down
[INFO] Stopping the Elasticsearch process at application shutdown ...
[INFO] Connector tcp://127.0.0.1:61616 stopped
[INFO] ... the Elasticsearch process has stopped. Exit code: 1

Although, this is happening intermittently, one common thing is, this always fails during load script (<pathInitScript>${elasticsearch.loadscript}</pathInitScript>) execution.

Could you please take a look?

Windows 10: This Elasticsearch process destroyer does not support this operation at startup

This seems to be related to #69 but the error displayed in Windows environments is a bit different, so I thought it was worth a separate issue for reference and documentation in case other stumble on it.

This is the error I got on Windows 10

[INFO] Using Elasticsearch [0] configuration: com.github.alexcojocaru.mojo.elasticsearch.v2.InstanceConfiguration@1351f28[id=0,baseDir=D:\myproject\target\elasticsearc
h0,httpPort=9200,transportPort=9300,pathData=<null>,pathLogs=<null>,settings=<null>]
[INFO] Elasticsearch[0]: Executing command '[cmd, /c, bin\elasticsearch-plugin, list]' in directory 'D:\myproject\target\elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[cmd, /c, bin\elasticsearch, -p, pid, -Ecluster.name=esDevCluster, -Ehttp.port=9200, -Etransport.tcp.port=9300, -Ehttp.cors.enabled=true]' in dir
ectory 'D:\myproject\target\elasticsearch0'
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
Exception in thread "Thread-5" java.lang.IllegalStateException: This Elasticsearch process destroyer does not support this operation
        at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedElasticsearchProcessDestroyer.remove(ForkedElasticsearchProcessDestroyer.java:50)
        at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:411)
        at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
        at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:222)
        at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:167)
        at com.github.alexcojocaru.mojo.elasticsearch.v2.ForkedInstance.run(ForkedInstance.java:42)
        at java.lang.Thread.run(Thread.java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:04 min
[INFO] Finished at: 2019-02-26T10:56:59-06:00
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:6.4:runforked (start-elasticsearch) on project marketplacecms: Condition returned by method "waitToStartIns
tance" in class com.github.alexcojocaru.mojo.elasticsearch.v2.client.Monitor was not fulfilled within 60 seconds. -> [Help 1]
[ERROR]```

Make the plugin thread safe - and annotate it as such

15:35:03 [WARNING] *****************************************************************
15:35:03 [WARNING] * Your build is requesting parallel execution, but project      *
15:35:03 [WARNING] * contains the following plugin(s) that have goals not marked   *
15:35:03 [WARNING] * as @threadSafe to support parallel building.                  *
15:35:03 [WARNING] * While this /may/ work fine, please look for plugin updates    *
15:35:03 [WARNING] * and/or request plugins be made thread-safe.                   *
15:35:03 [WARNING] * If reporting an issue, report it against the plugin in        *
15:35:03 [WARNING] * question, not against maven-core                              *
15:35:03 [WARNING] *****************************************************************
15:35:03 [WARNING] The following plugins are not marked @threadSafe in [...]:
15:35:03 [WARNING] com.github.alexcojocaru:elasticsearch-maven-plugin:6.6
15:35:03 [WARNING] Enable debug to see more precisely which goals are not marked @threadSafe.
15:35:03 [WARNING] *****************************************************************

Allow to add plug-ins as Maven dependency

I would like to add plug-ins obtainable via Maven to the bootstrapped ES instance. Unless there is already a convinient way for doing this, I am proposing to add support for it like so:

<plugin>
    <groupId>com.github.alexcojocaru</groupId>
    <artifactId>elasticsearch-maven-plugin</artifactId>
    <version>2.0</version>
    <configuration>
        <clusterName>hsearch-es-test-cluster</clusterName>
        <tcpPort>9300</tcpPort>
        <httpPort>9200</httpPort>
        <pluginsPath>${project.build.directory}/_ES_PLUGINS_</pluginsPath>

        <!-- Obtains plug-in ZIPs given via Maven group + artifact id -->
        <pluginArtifacts>
            <pluginArtifact>org.elasticsearch.plugin:delete-by-query:2.0.0</pluginArtifact>
            <pluginArtifact>org.elasticsearch.plugin:analyzer-icu:2.0.0</pluginArtifact>
            ...
        </pluginArtifacts>
    </configuration>
    <executions>
        ...
    </executions>
</plugin>

If you like the idea in general, I could try and help out with implementing it. WDYT?

Provide some example project

I try to execute the given example projects in the src/it directory using the version 6.5 of the maven module (maven version is 3.3.9), but the tests are halting on the same error (Caused by: java.io.FileNotFoundException: test.properties (The file or the directory not exists). For example:

`[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/src/test/resources
[INFO]
[INFO] --- elasticsearch-maven-plugin:6.5:runforked (run) @ test ---
[INFO] Using Elasticsearch [0] configuration: com.github.alexcojocaru.mojo.elasticsearch.v2.InstanceConfiguration@61942c1[id=0,baseDir=/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0,httpPort=9200,transportPort=9300,pathData=,pathLogs=,settings=]
Downloading: https://oss.sonatype.org/content/groups/public/org/elasticsearch/distribution/zip/elasticsearch/6.0.0/elasticsearch-6.0.0.zip
Downloaded: https://oss.sonatype.org/content/groups/public/org/elasticsearch/distribution/zip/elasticsearch/6.0.0/elasticsearch-6.0.0.zip (27401 KB at 2006.0 KB/sec)
[INFO] Elasticsearch[0]: Executing command '[chmod, 755, bin/elasticsearch-plugin]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[sed, -i, -e, 1s:.:#!/usr/bin/env bash:, bin/elasticsearch-plugin]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch-plugin, list]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[chmod, 755, bin/elasticsearch]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[sed, -i, -e, 1s:.
:#!/usr/bin/env bash:, bin/elasticsearch]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[INFO] Elasticsearch[0]: The process finished with exit code 0
[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch, -p, pid, -Ecluster.name=test, -Ehttp.port=9200, -Etransport.tcp.port=9300, -Ehttp.cors.enabled=true]' in directory '/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0'
[2018-06-14T11:16:08,049][INFO ][o.e.n.Node ] [] initializing ...
[2018-06-14T11:16:08,852][INFO ][o.e.e.NodeEnvironment ] [GqvgITe] using [1] data paths, mounts [[/home (/dev/nvme0n1p4)]], net usable_space [16.7gb], net total_space [176gb], types [ext4]
[2018-06-14T11:16:08,857][INFO ][o.e.e.NodeEnvironment ] [GqvgITe] heap size [990.7mb], compressed ordinary object pointers [true]
[2018-06-14T11:16:08,871][INFO ][o.e.n.Node ] node name [GqvgITe] derived from node ID [GqvgITeLQVW62jbZ6tfX-A]; set [node.name] to override
[2018-06-14T11:16:08,879][INFO ][o.e.n.Node ] version[6.0.0], pid[20731], build[8f0685b/2017-11-10T18:41:22.859Z], OS[Linux/4.13.0-45-generic/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_171/25.171-b11]
[2018-06-14T11:16:08,909][INFO ][o.e.n.Node ] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0, -Des.path.conf=/home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/elasticsearch0/config]
[2018-06-14T11:16:12,697][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [aggs-matrix-stats]
[2018-06-14T11:16:12,698][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [analysis-common]
[2018-06-14T11:16:12,699][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [ingest-common]
[2018-06-14T11:16:12,701][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [lang-expression]
[2018-06-14T11:16:12,709][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [lang-mustache]
[2018-06-14T11:16:12,710][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [lang-painless]
[2018-06-14T11:16:12,711][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [parent-join]
[2018-06-14T11:16:12,711][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [percolator]
[2018-06-14T11:16:12,711][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [reindex]
[2018-06-14T11:16:12,712][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [repository-url]
[2018-06-14T11:16:12,712][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [transport-netty4]
[2018-06-14T11:16:12,713][INFO ][o.e.p.PluginsService ] [GqvgITe] loaded module [tribe]
[2018-06-14T11:16:12,713][INFO ][o.e.p.PluginsService ] [GqvgITe] no plugins loaded
[2018-06-14T11:16:14,399][INFO ][o.e.d.DiscoveryModule ] [GqvgITe] using discovery type [zen]
[2018-06-14T11:16:15,230][INFO ][o.e.n.Node ] initialized
[2018-06-14T11:16:15,231][INFO ][o.e.n.Node ] [GqvgITe] starting ...
[2018-06-14T11:16:15,475][INFO ][o.e.t.TransportService ] [GqvgITe] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2018-06-14T11:16:15,489][WARN ][o.e.b.BootstrapChecks ] [GqvgITe] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2018-06-14T11:16:18,585][INFO ][o.e.c.s.MasterService ] [GqvgITe] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {GqvgITe}{GqvgITeLQVW62jbZ6tfX-A}{Ac3eFxW0QRq1LSD6FFDlWw}{127.0.0.1}{127.0.0.1:9300}
[2018-06-14T11:16:18,590][INFO ][o.e.c.s.ClusterApplierService] [GqvgITe] new_master {GqvgITe}{GqvgITeLQVW62jbZ6tfX-A}{Ac3eFxW0QRq1LSD6FFDlWw}{127.0.0.1}{127.0.0.1:9300}, reason: apply cluster state (from master [master {GqvgITe}{GqvgITeLQVW62jbZ6tfX-A}{Ac3eFxW0QRq1LSD6FFDlWw}{127.0.0.1}{127.0.0.1:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-06-14T11:16:18,609][INFO ][o.e.h.n.Netty4HttpServerTransport] [GqvgITe] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2018-06-14T11:16:18,610][INFO ][o.e.n.Node ] [GqvgITe] started
[2018-06-14T11:16:18,627][INFO ][o.e.g.GatewayService ] [GqvgITe] recovered [0] indices into cluster_state
[INFO] The Elasticsearch instance has started
[2018-06-14T11:16:19,305][WARN ][o.e.h.n.Netty4HttpServerTransport] [GqvgITe] caught exception while handling client http traffic, closing connection [id: 0x94b4441a, L:/127.0.0.1:9200 - R:/127.0.0.1:55440]
java.io.IOException: A kapcsolatot bontotta a távoli fél
at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.8.0_171]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.8.0_171]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.8.0_171]
at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[?:1.8.0_171]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[?:1.8.0_171]
at io.netty.buffer.PooledHeapByteBuf.setBytes(PooledHeapByteBuf.java:261) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:544) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.13.Final.jar:4.1.13.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
[INFO] The Elasticsearch cluster has started
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ test ---
[2018-06-14T11:16:20,374][WARN ][o.e.h.n.Netty4HttpServerTransport] [GqvgITe] caught exception while handling client http traffic, closing connection [id: 0xc9767643, L:/127.0.0.1:9200 - R:/127.0.0.1:55442]
java.io.IOException: A kapcsolatot bontotta a távoli fél
at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:1.8.0_171]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:1.8.0_171]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:1.8.0_171]
at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[?:1.8.0_171]
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[?:1.8.0_171]
at io.netty.buffer.PooledHeapByteBuf.setBytes(PooledHeapByteBuf.java:261) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:544) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.13.Final.jar:4.1.13.Final]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] Surefire report directory: /home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/surefire-reports


T E S T S

Running com.github.alexcojocaru.mojo.elasticsearch.v2.DefaultsTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.076 sec <<< FAILURE!
com.github.alexcojocaru.mojo.elasticsearch.v2.DefaultsTest Time elapsed: 0.075 sec <<< ERROR!
java.lang.RuntimeException: Cannot load httpPort from test.properties
at com.github.alexcojocaru.mojo.elasticsearch.v2.ItBase.beforeClass(ItBase.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
at org.mockito.internal.runners.SilentJUnitRunner.run(SilentJUnitRunner.java:39)
at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:39)
at org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:104)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.io.FileNotFoundException: test.properties (Nincs ilyen fájl vagy könyvtár)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at java.io.FileInputStream.(FileInputStream.java:93)
at com.github.alexcojocaru.mojo.elasticsearch.v2.ItBase.beforeClass(ItBase.java:36)
... 24 more

Results :

Tests in error:
com.github.alexcojocaru.mojo.elasticsearch.v2.DefaultsTest: Cannot load httpPort from test.properties

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.121 s
[INFO] Finished at: 2018-06-14T11:16:21+02:00
[INFO] Final Memory: 24M/262M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project test: There are test failures.
[ERROR]
[ERROR] Please refer to /home/totha/work/elastic-hunspell/elasticsearch-maven-plugin/src/it/runforked-defaults-es6/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[INFO] Cleaning up at application shutdown...
[INFO] The Elasticsearch process is still running; stopping it ...
[INFO] ... the Elasticsearch process [0] has stopped. Exit code: 143
`
Can you help me in, what the problem is?

Thanks in advance!
Adrian

java.io.IOException: An existing connection was forcibly closed by the remote host

I got the following, when run mvn verify

[2018-05-30T14:28:24,065][WARN ][o.e.h.n.Netty4HttpServerTransport] [h3Pu-H5] caught exception while handling client http traffic, closing connection [id: 0x172478f4, L:/0:0:0:0:0:0:0:1:9400 - R:/0:0:0:0:0:0:0:1:52160]
java.io.IOException: An existing connection was forcibly closed by the remote host

Than it proceed and execute all required operations, but would like to avoid this exception.

Plugin in pom

        <plugin>
            <groupId>com.github.alexcojocaru</groupId>
            <artifactId>elasticsearch-maven-plugin</artifactId>
            <version>6.5</version>
            <configuration>
                <clusterName>testCluster</clusterName>
                <transportPort>9500</transportPort>
                <timeout>5000</timeout>
                <httpPort>9400</httpPort>
                <version>5.4.0</version>
                <pathInitScript>src/test/resources/elasticsearch/Init.script</pathInitScript>
            </configuration>
            <executions>
                <execution>
                    <id>start-elasticsearch</id>
                    <phase>process-test-classes</phase>
                    <goals>
                        <goal>runforked</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-elasticsearch</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> 

ElasticSearch stopping after Init script execution

Hello,
I am new at using this plugin, so my apologies if this is a stupid question.

What I am trying to do is, run the elasticsearch instance and then run my application that will connect to this instance. But, when I run - "mvn elasticsearch:runforked". It starts, runs the Init script and then stops.

Instead I want to keep it running after the Init script.

[INFO] The Elasticsearch instance has started
[INFO] The Elasticsearch cluster has started
[INFO] Sending PUT request to http://localhost:9200/test/ with entity '{ "mappings":{"default":{ "properties":{ "myField":{"type":"keyword"}}}}}'
[2018-02-26T16:21:58,423][INFO ][o.e.c.m.MetaDataCreateIndexService] [aswHGsc] [test] creating index, cause [api], templates [], shards [5]/[1], mappings [default]
[INFO] Sending PUT request to http://localhost:9200/test/default/1 with entity '{ "myField ":"hello world"}'
[2018-02-26T16:21:58,692][INFO ][o.e.c.m.MetaDataMappingService] [aswHGsc] [test/tKNrCWV3RLu8ypMUPqL5XQ] update_mapping [default]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.795 s
[INFO] Finished at: 2018-02-26T16:21:58-08:00
[INFO] Final Memory: 18M/310M
[INFO] ------------------------------------------------------------------------
[INFO] Stopping the Elasticsearch process at application shutdown ...
[INFO] ... the Elasticsearch process has stopped. Exit code: 143

Thank you

Sincerely,
Manjiri

Do not fail when a plugin has already been installed

When I add a plugin with its file URL like file://path/to/target/myplugin.zip and start again the same mvn install command, it fails because the plugin already exists.

Tested with 5.4.2:

[INFO] Elasticsearch[0]: Executing command '[bin/elasticsearch-plugin, install, --batch, file:///Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/integration-tests/plugins/x-pack-5.4.2.zip]' in directory '/Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/elasticsearch0'
-> Downloading file:///Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/integration-tests/plugins/x-pack-5.4.2.zip
[=================================================] 100%   
ERROR: plugin directory [/Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/elasticsearch0/plugins/x-pack] already exists; if you need to update the plugin, uninstall it first using command 'remove x-pack'
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.137 s
[INFO] Finished at: 2017-06-21T14:18:09+02:00
[INFO] Final Memory: 30M/325M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.7:runforked (start-elasticsearch) on project elasticsearch-beyonder: Elasticsearch [0]: Cannot execute command '[bin/elasticsearch-plugin, install, --batch, file:///Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/integration-tests/plugins/x-pack-5.4.2.zip]' in directory '/Users/dpilato/Documents/Elasticsearch/dev/elasticsearch-beyonder/target/elasticsearch0': Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

IMHO this should not fail the build or at least we need an option to ignore that failure.

WDYT?

can not run elasticsearch as root

Hi,

I wrote some tests using the plugin, all works as expected.
when running our project on our jenkins we get "can not run elasticsearch as root".

I know that ES cannot run as root user, is there any option in the plugin settings to run it as different user? or any other solution?

Thanks

Failed to bind to: /127.0.0.1:9399: Address already in use

We are using your plugin for integration test.
The problem is that sometimes, We have an error when try to start ES, because the port is already in use.
Maybe because the previous execution of the job was stopped before finish and elasticsearch did not stopped.
At the same time, we start up a jetty instance, but we never have problems when with stop the job before to finish.

[INFO] [ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:1.9:start (start-elasticsearch) on project search-ws: Execution start-elasticsearch of goal com.github.alexcojocaru:elasticsearch-maven-plugin:1.9:start failed: Failed to bind to [9399]: Failed to bind to: /127.0.0.1:9399: Address already in use

Note: We are using port 9399 as the http port.

I am going to try to reproduce the error in my local environment.

SocketTimeoutException when ES is initialized.

I get the following error when the plugin initializes ES via init script:

[ERROR] Failed to execute goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.1:runforked (start-elasticsearch) on project es: Execution start-elasticsearch of goal com.github.alexcojocaru:elasticsearch-maven-plugin:5.1:runforked failed: Cannot execute command PUT:test_index:{}: java.net.SocketTimeoutException: Read timed out -> [Help 1]

Log directory always empty

I am not sure whether it's a bug or usage error on my side, but for some reason the log directory is always empty ("elasticsearch-logs"). Is there anything I need to configure to see exception logs there?

I could make it work by adding an slf4j binding as a plug-in dependency and building elasticsearch-maven-plugin from sources, so it contains a log4j.properties file (I'm using log4j); Then I could see at least all exceptions on the Maven console. But clearly that cannot be the right way :)

Any help is highly appreciated!

Allow dots in field names (ES 2.4.x)

Hi,
I have a project that currently uses ES 1.7.5 and is targeting ES 2.4.x for an upgrade, and has dots in the names of some fields. These names must retain dots, as they come from/are used by other parts of a distributed system.

ES <2.4 does not support dots in field names, but ES 2.4.x supports dots via a commandline option -Dmapper.allow_dots_in_name=true (See the ES docs). This issue is to request support for mapper.allow_dots_in_name via the config for this plugin, so that we can set the option in our integration tests automatically.

I have tried setting the option via maven-failsafe-plugin, both as a system property and as part of the argLine options, to no avail, but the option flag can be added to a mvn verify command: mvn verify -Dmapper.allow_dots_in_name=true.

Add support for x-pack (security)

When you add x-pack as a plugin, elasticsearch maven plugin refuses to start because it can't access to GET / due to default security.

It gives:

[DEBUG] Sending GET request to http://localhost:9400/
[DEBUG] Response with status code 401 and content: {"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"missing authentication token for REST request [/]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

We need to add support for username and password (default to elastic and changeme).

I'll hopefully will come with a PR for it.

Make plugin independent from environment variables

When ES_HOME or ES_PATH_CONF are set, the ES instance started by the plugin uses those values instead of the provided ones, which often results in a failure.

Remove ES_HOME, ES_JAVA_OPTS and ES_PATH_CONF from the environment when spawning the ES process.

Node seems to be killed when running in TravisCI

I just switched my project to elasticsearch-maven-plugin (which is great BTW) and I found that my elasticsearch node is getting killed apparently.

The build is working super fine locally. But fails in TravisCI.

For example this build: https://travis-ci.org/dadoonet/spring-elasticsearch/builds/210279724

I suspect this is caused by travis-ci/travis-ci#6534 but I would expect elasticsearch barfing more before dying actually.

May be there is a workaround or may be we should just document that it can happen an link to the Travis issue in the doc?

Some logs:

[2017-03-12T15:59:20,974][INFO ][o.e.n.Node               ] [Q3beqyO] starting ...
[2017-03-12T15:59:21,133][WARN ][i.n.u.i.MacAddressUtil   ] Failed to find a usable hardware address from the network interfaces; using random bytes: 26:93:fc:18:6b:6a:2c:ed
[2017-03-12T15:59:21,203][INFO ][o.e.t.TransportService   ] [Q3beqyO] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2017-03-12T15:59:21,211][WARN ][o.e.b.BootstrapChecks    ] [Q3beqyO] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[DEBUG] Sending GET request to http://localhost:9200/
[DEBUG] Sending GET request to http://localhost:9200/
[DEBUG] Sending GET request to http://localhost:9200/
[2017-03-12T15:59:24,271][INFO ][o.e.c.s.ClusterService   ] [Q3beqyO] new_master {Q3beqyO}{Q3beqyOTRNmkkow3pXMK0g}{biMDuBQdQD2bxga9m2Cm6Q}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-03-12T15:59:24,334][INFO ][o.e.h.HttpServer         ] [Q3beqyO] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2017-03-12T15:59:24,335][INFO ][o.e.n.Node               ] [Q3beqyO] started
[2017-03-12T15:59:24,349][INFO ][o.e.g.GatewayService     ] [Q3beqyO] recovered [0] indices into cluster_state
[DEBUG] Sending GET request to http://localhost:9200/
[DEBUG] Response with status code 200 and content: {  "name" : "Q3beqyO",  "cluster_name" : "elasticsearch",  "cluster_uuid" : "zYXkHQ0nRmSeZiXf9o04OQ",  "version" : {    "number" : "5.2.2",    "build_hash" : "f9d9b74",    "build_date" : "2017-02-24T17:26:45.835Z",    "build_snapshot" : false,    "lucene_version" : "6.4.1"  },  "tagline" : "You Know, for Search"}
[DEBUG] Elasticsearch has started

Then some tests are running well:

15:59:30,846 DEBUG [f.p.e.t.i.IndexElasticsearchUpdater] Index [twitter] doesn't exist. Creating it.
15:59:30,847 TRACE [f.p.e.t.i.IndexElasticsearchUpdater] createIndex([twitter])
15:59:30,848 TRACE [f.p.e.t.i.IndexElasticsearchUpdater] Found settings for index [twitter]: [{
}]
[2017-03-12T15:59:31,063][INFO ][o.e.c.m.MetaDataCreateIndexService] [Q3beqyO] [twitter] creating index, cause [api], templates [], shards [5]/[1], mappings []
15:59:31,459 TRACE [f.p.e.t.i.IndexElasticsearchUpdater] /createIndex([twitter])
15:59:31,462 TRACE [f.p.e.t.SettingsReader] Reading file [es/twitter/tweet.json]...
15:59:31,537 DEBUG [f.p.e.t.t.TypeElasticsearchUpdater] Type [twitter]/[tweet] doesn't exist. Creating it.
15:59:31,537 TRACE [f.p.e.t.t.TypeElasticsearchUpdater] createType([twitter/tweet])
[2017-03-12T15:59:32,333][INFO ][o.e.c.m.MetaDataMappingService] [Q3beqyO] [twitter/LT0TS5uFSpa4Is78h-8naA] create_mapping [tweet]
15:59:32,818 TRACE [f.p.e.t.t.TypeElasticsearchUpdater] /createType([twitter/tweet])
15:59:32,818 DEBUG [f.p.e.t.t.TypeElasticsearchUpdater] Type definition for [twitter]/[tweet] succesfully created.
15:59:32,818 TRACE [f.p.e.t.i.IndexSettingsReader] Reading [_settings.json] for [rss] in [es]...
15:59:32,818 TRACE [f.p.e.t.SettingsReader] Reading file [es/rss/_settings.json]...
15:59:32,819 TRACE [f.p.e.t.SettingsReader] Can not find [es/rss/_settings.json] in class loader.
15:59:36,115 DEBUG [f.p.e.t.i.IndexElasticsearchUpdater] Index [rss] doesn't exist. Creating it.
15:59:36,115 TRACE [f.p.e.t.i.IndexElasticsearchUpdater] createIndex([rss])

And suddenly 💥

15:59:36,171 WARN  [o.s.c.s.ClassPathXmlApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esClient': Invocation of init method failed; nested exception is NoNodeAvailableException[None of the configured nodes were available: [{Q3beqyO}{Q3beqyOTRNmkkow3pXMK0g}{biMDuBQdQD2bxga9m2Cm6Q}{127.0.0.1}{127.0.0.1:9300}]]; nested: NodeDisconnectedException[[Q3beqyO][127.0.0.1:9300][indices:admin/create] disconnected];
15:59:36,173 INFO  [o.e.c.t.TransportClientNodesService] failed to get node info for {#transport#-1}{oBLQPybTT2akQRbmQF7o8g}{127.0.0.1}{127.0.0.1:9300}, disconnecting...
org.elasticsearch.transport.NodeDisconnectedException: [][127.0.0.1:9300][cluster:monitor/nodes/liveness] disconnected

If we look at elasticsearch logs:

[2017-03-12T15:59:24,349][INFO ][o.e.g.GatewayService     ] [Q3beqyO] recovered [0] indices into cluster_state
[2017-03-12T15:59:31,063][INFO ][o.e.c.m.MetaDataCreateIndexService] [Q3beqyO] [twitter] creating index, cause [api], templates [], shards [5]/[1], mappings []
[2017-03-12T15:59:32,333][INFO ][o.e.c.m.MetaDataMappingService] [Q3beqyO] [twitter/LT0TS5uFSpa4Is78h-8naA] create_mapping [tweet]

The process has been killed without any notice as we can see when elasticsearch-maven-plugin tries to stop it:

[INFO] --- elasticsearch-maven-plugin:5.7:stop (stop-elasticsearch) @ spring-elasticsearch ---
[INFO] Stopping Elasticsearch [com.github.alexcojocaru.mojo.elasticsearch.v2.InstanceConfiguration@6f2864c3[id=0,baseDir=/home/travis/build/dadoonet/spring-elasticsearch/target/elasticsearch0,httpPort=0,transportPort=0,pathData=<null>,pathLogs=<null>]]
[DEBUG] Using environment: null
[INFO] Elasticsearch[0]: Executing command '[kill, 1595]' in directory '/home/travis/build/dadoonet/spring-elasticsearch/target/elasticsearch0'
kill: No such process
[ERROR] Exception while stopping Elasticsearch
com.github.alexcojocaru.mojo.elasticsearch.v2.ElasticsearchSetupException: Elasticsearch [0]: Cannot execute command '[kill, 1595]' in directory '/home/travis/build/dadoonet/spring-elasticsearch/target/elasticsearch0'
	at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:108)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:56)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.StopMojo.execute(StopMojo.java:44)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
	at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)
	at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:166)
	at com.github.alexcojocaru.mojo.elasticsearch.v2.util.ProcessUtil.executeScript(ProcessUtil.java:91)
	... 23 more

Let me know if you have any idea/workaround for this. Feel free to close if you don't think we can document anything regarding this problem.

The JVM Shutdownhook seems not to be working on Windows

When the stop goal is not executed, (due to a failing test), the ES instance is still running. Consecutive executions of maven will fail.

The log output shows:

[INFO] Stopping the Elasticsearch process at application shutdown ...
[INFO] ... the Elasticsearch process has stopped. Exit code: 1

On Linux it works:

[INFO] Stopping the Elasticsearch process at application shutdown ...
[INFO] ... the Elasticsearch process has stopped. Exit code: 143

Environment:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: c:\Apps\apache-maven-3.3.9
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: c:\Apps\Java\jdk8_112_64\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

Plugin Version 6.0
ES Version 5.6.3

ES v6.3.0 fails to start with "Permission denied" for the x-pack-ml module

With the new version of ES there are now 2 different distribution flavors:

  • "elasticsearch" (default, with x-pack) and
  • "elasticsearch-oss" (OSS only, no x-pack).

Some people might need to run tests against either of the two flavors, so I suggest you expose the artifactId configuration property for specifying which flavor to download. Alternatively, you could have a config flag isOSSflavor or something similar.

Also when the default flavor of 6.3.0 is downloaded and started, I get a "Permission denied" exception because the executables inside elasticsearch0/modules/x-pack do not have +x permissions on them. So we'd have to run an additional command chmod 755 on the "modules" folder to get the default flavor running.

Run with local version of elastic

I have a local version of elastic search zip in my build directory. is there a possibility to skip the download and use the local version

No implementation for org.eclipse.aether.RepositorySystem was bound

I am getting this error:

WARNUNG: Error injecting: com.github.alexcojocaru.mojo.elasticsearch.v2.RunForkedMojo
com.google.inject.ProvisionException: Guice provision errors:

1) No implementation for org.eclipse.aether.RepositorySystem was bound.
  while locating com.github.alexcojocaru.mojo.elasticsearch.v2.RunForkedMojo

1 error
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:999)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1025)
    at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
    at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:990)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1036)
    at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:986)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
    at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

With the maven version shipped with Ubuntu 14.04 LTS

mvn --version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: de_DE, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-38-generic", arch: "amd64", family: "unix"

Is there any change to make this plugin compatible to the 3.0 branch of maven?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.