Transform an existing Java project, using Gradle to build

Source: Internet
Author: User
Tags log4j

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.