How to run specific subprojects of elasticsearch source code

(Mohan Kumar U) #1

Is there a way to rebuild only the file or sub-projects which i modify.So that i need not build the whole project again.
Also every time i make a change in file,i had to restart my windows to delete .lock file,there has to be some way to handle this.

(Henning Andersen) #2

Hi @MKU,

using gradle, you can run just the specific part of the build using -p option, ie.:

./gradlew -p server assemble

Using IntelliJ (or eclipse I believe), the IDE ensures to only recompile necessary modified files if you for instance run a test case.

I run linux, so cannot help on the .lock file (though I am curious as to where that file is located?).

(Mohan Kumar U) #3

Hi,
\distribution\build\cluster\run node0\elasticsearch-7.0.0-SNAPSHOT\data\nodes\0\node.lock.

How can i run gradlew run for the second time after making any changes ,if i try to run it for the second time i get error saying cannot delete node.lock.
So to test my changes i have to restart my windows again.
Is there any solution for this?

Thanks

(Henning Andersen) #4

Hi @MKU,

I would like to see the specificic error message/log when this happens? Preferably running it with

./gradlew --stacktrace run

to get stacktrace info from gradle.

Additionally, can I please ask you to also double check that any previous elasticsearch instances are shut down before the second gradle run (in the task manager/process explorer)?

(Mohan Kumar U) #5

I made sure no instances of elasticsearch is running in taskmanager and services.
The error is given below(because of character limit i skipped some )

Task :distribution:run#clean FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':distribution:run#clean'.

Unable to delete directory: C:\Users\mkumaru\Desktop\Elastic\elasticsearch\distribution\build\cluster\run node0\elasticsearch-7.0.0-SNAPSHOT\data\nodes\0

  • Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':distribution:run#clean'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:95)
    at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveBuildCacheKeyExecuter.execute(ResolveBuildCacheKeyExecuter.java:79)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:57)

Caused by: org.gradle.api.file.UnableToDeleteFileException: Unable to delete directory: C:\Users\mkumaru\Desktop\Elastic\elasticsearch\distribution\build\cluster\run node0\elasticsearch-7.0.0-SNAPSHOT\data\nodes\0
at org.gradle.api.internal.file.delete.Deleter.handleFailedDelete(Deleter.java:109)
at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:86)
at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:81)
at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:81)
at org.gradle.api.internal.file.delete.Deleter.doDeleteInternal(Deleter.java:81)
at org.gradle.api.internal.file.delete.Deleter.delete(Deleter.java:66)

(Henning Andersen) #6

As an experiment could you please try to delete the node.lock file through regular windows tools like either explorer or command line. Could be interesting to see what error message it gives if any.

(Mohan Kumar U) #7

File access denied.
You require permission from computer's administrator to make changes to this file.

but i am trying to delete it by administration permission,but this throws the same error.

(Henning Andersen) #8

One more thing: you may want to try to shutdown the gradle daemon too, using:

./gradlew --stop

(Mohan Kumar U) #9

I tried ,still same error.

(Henning Andersen) #10

I think next step is to figure out which process has the lock on the file, I believe this is possible using:

Also, just to confirm, you are running a relatively new version of windows?

(Mohan Kumar U) #11

Hi @HenningAndersen,
I used process explorer and the process which is using it is explorer.exe.
I am using new version of windows.

(Mohan Kumar U) #12

Hello @warkolm, Can you solve this issue,i am having a difficult time with this.

(Сергей Алещенко) #13

Well, nothing help me. What's the solution?

(Mohan Kumar U) #16

Find the process id ,kill it and then run.

(Сергей Алещенко) #17

That's a crutch, not a solution =)
Nevertheless the error does not reproduce any more. I'm not sure what happened. I just killed the process several times as you said and it dissappeared =)

(Сергей Алещенко) #18

(Mohan Kumar U) #19

I modified this file server\src\main\java\org\elasticsearch\rest\restcontroller.java,
I would like to build/run that specific file , what should be the command.

Thanks

(system) closed #20

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.