U
U
useIT2020-07-23 14:48:34
Java
useIT, 2020-07-23 14:48:34

How to configure IDEA so that when changing the class name in the java file, the mainClassName in build.gradle automatically changes?

How to configure IDEA so that when changing the class name in the java file, the mainClassName in build.gradle automatically changes?
1. File structure:
Boxy directory:
src
main
java
code file

build.gradle

2. Modules imported from build.gradle config file
3. Java code:
public class newLO {
public static void main(String[] args){
System. out.println("Hi!");
}
}

4. It is necessary that when changing the class name in the java file, IDEA notices the change and suggests changing (DO refactor) the class name in the build.gradle configuration file:
apply plugin: 'java'
apply plugin: 'application'
mainClassName = "newF"

Only the file name changes at the moment, the value of mainClassName = "newF" remains the same.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question