How to run specific subprojects of elasticsearch source code

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.

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?).

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

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)?

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)

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.

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.

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

./gradlew --stop

I tried ,still same error.

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?

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

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

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

Find the process id ,kill it and then run.

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 =)

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

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