The existing Java project into the Gradle project, through the Buildship plug-in, the conversion is always an error, so the manual came; not very complicated, follow the steps.
Suppose the simple Java project structure is as follows:
1: Create the file under the root of the project Build.gradle
2: Add the Gradle script as needed, as shown in the following example:
Apply plugin: ' java '
apply plugin: ' eclipse '
archivesbasename = ' Somejar '
version = ' 1.0-snapshot
' repositories {
mavencentral ()
}
jar {
manifest {
attributes ' Main-class ': ' Com.test.Run
' }
}
dependencies {
compile ' log4j:log4j:1.2.16 '
3: Close or delete items, then re-import to eclipse, select Gradle Project when importing
Now the project structure is as follows
4: Create folder Src/main/java, move all packages to this folder
5:ok, manually add the necessary source folders and configuration files. At this point, the Java project has been turned into a gradle project.