Now that the Gradle work is mostly completed, I would like to share my experiences setting up my repository to use Gradle to build via the command line and to integrate with my Eclipse development environment.
I started by re-cloning my GitHub repository to remove all of the generated Ant-related directories and files. $ git clone [email protected]:queeniema/incubator-edgent.git Then, I updated my cloned repository with the latest changes from the remote repository (my remote is called 'upstream'). $ git co master;git fetch upstream;git merge upstream/master;git push Where I would normally use Ant to build the Edgent code, I used Gradle, following the steps in the DEVELOPMENT.MD file. The first command below automatically downloaded Gradle 3.1 for me. The second command ran the default 'assemble' task, which built all code and Javadoc into 'build\distributions'. $ ./gradlew --version $ ./gradlew The build was successful and completed in about 17 seconds. I tried compiling and running a sample Edgent application (Console Water Detector) from the command line as follows. It was successful. $ java -cp build/distributions/java8/samples/lib/edgent.samples.console.jar:. org.apache.edgent.samples.console.ConsoleWaterDetector I then made some changes to the application and re-compiled using: ./gradlew. It was very quick (about 2 seconds)! Usually, I use Eclipse to run my applications, so I wanted to set that up as well. Based on the comments in the DEVELOPMENT.MD file, I knew that I would need to perform some addtional steps that I did not need to do when using Ant since the 3rd party JARs are no longer included in the Git repository. I started with a fresh workspace by deleting the Edgent directories from my workspace. Here are the steps I followed: 1. From the File menu, select 'Import' 2. From the Git folder, select 'Projects from Git' and click 'Next' 3. Select 'Existing local repository' and click 'Next' 4. Select the 'incubator-edgent' Git repository (it was already displayed since I had added it previously when creating the workspace) and click 'Next'. Otherwise, click 'Add' and navigate to the Git repository (in my case, '/Users/queeniema/github/incubator-edgent'). 5. Select 'Import existing Eclipse projects' and click 'Next' 6. In the Import Projects window, make sure that the 'Search for nested projects' checkbox is selected. Click 'Finish' to bring in all Edgent projects. There will be errors in your workspace. 7. Run a Gradle task to make all of the dependant 3rd party JARs available to Eclipse. When the command finishes, refresh your Eclipse workspace (File > Refresh) so that it rebuilds the projects. There should be no errors in your workspace. - $ ./gradlew setupExternalJars I tried running the Console Water Detector application once more, this time from Eclipse, by right-clicking on the ConsoleWaterDetector.java file and selecting 'Run As' > 'Java Application'. It ran successfully as it did before! Success! Overall, my experience in switching over from Ant to Gradle went smoothly thanks to the clear documentation instructions, and I didn't run into any issues. I hope this will help others set up their environments as well! -- Queenie On Fri, Sep 30, 2016 at 6:57 AM, Dale LaBossiere <[email protected]> wrote: > I’ve merged EDGENT-251 / PR-201 which changes how Eclipse builds deal with > references to 3rd-party jars. > When you rebase and pickup commit bd71ad8 your Eclipse based Edgent > runtime builds will fail until you take the necessary action. > See EDGENT-251 for details: https://issues.apache.org/ > jira/browse/EDGENT-251 <https://issues.apache.org/jira/browse/EDGENT-251> > > — Dale
