Access to add and change pages is restricted. See: https://cwiki.apache.org/confluence/display/OFBIZ/Wiki+access

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 50 Next »

Pre Gradle version

This page documents the usage with Gradle, the pre-Gradle documentation is here: Eclipse Tips (pre Gradle version)

Children pages


Table of contents

Most important shortcuts

  • CTRL+SHIFT+R for finding resources!
  • CTRL+H for finding text in files
  • The rest you will find on Internet (smile)

Note: though it's now more history, for me at least, here is what I got through initially when working with Gradle in Eclipse Unable to render Jira issues macro, execution error.

Setting up Eclipse to work with OFBiz is easy.

There are two ways to import OFBiz into Eclipse:

  1. You can either allow Eclipse to download OFBiz directly from SVN,
  2. or you can import an already downloaded copy of OFBiz (from SVN or otherwise) from the filesystem.

Importing OFBiz from the filesystem into Eclipse

If you have already downloaded OFBiz and do not wish to have Eclipse handle SVN pulls for you, Eclipse can import OFBiz from the filesystem as well.

First you need to generate the ".project" file to allow Eclipse to automatically configure the project for you. For that simply run "gradlew eclipse" on the command line.

Then all you have to do to import the project is:

  1. Right-click in the Navigator window and click on Import.
  2. Select "Existing Project into Workspace" and click Next.
  3. Click Browse and select the directory that contains the ".project" file, then click Finish. When this is complete, a new project named "ofbiz" will now appear in your Navigator. This will not copy the project to Eclipse's workspace directory: it will remain wherever it was before the import. If you want the OFBiz files in your workspace directory, you must move them there before you do the import.

 


Using SVN from within Eclipse

If you want to do the SVN pull from within Eclipse, use the following steps:

  1. First you need to install Subclipse
  2. Bring up the "SVN Repository" panel in Eclipse (Window/Open Perspective/SVN Repository Exploring)
  3. Right-Click within panel/New/Repository Location the url is http://svn.apache.org/repos/asf/ofbiz/trunk
  4. Click on Finish. Now, do the initial checkout.
  5. Click the "+" next to the new repository
  6.  then Right-Click on trunk and select "Checkout...".
  7. Select "Check out as project in the workspace" and click on "Finish".
  8. This will create a new project that you can name as you want and download the OFBiz files directly from SVN. To sync your project with SVN in the future, right-click on the project and click Teams/Synchronize with Repository.

Hide folders from searches

Most of the time you don't want to look into some folders because there is nothing interesting there and they sometimes annoy you because of search errors (sad)

Then you tool of choice is https://nodj.github.io/AutoDeriv/

For your convenience here is the content of the .derived file I set at the root of my workspace folder, YMMV...

# sets these folders as derived
*.gradle
.settings
bin
build
gradle
lib
runtime/indexes
runtime/catalina
runtime/data
runtime/logs/birt
runtime/output
runtime/tempfiles
runtime/tmp
runtime/uploads

Using local XSD's when no internet connection is available, or you are using another version than the one online

Eclipse uses XSD files to check XML files for correctness and also when using autocompletion. Normally, eclipse uses the XSD location specified at the top of the XML file which is usually a remote address. If you do not have an internet connection, the XSD will not be found and these features will not be available (unless they have been previously cached by eclipse).

A new file .catalog.xml has been introduced in OFBiz root starting from svn 1326499. This file contains a definition compliant with the Oasis Catalog specification of all schemas used by ofbiz. You can import it in you Eclipse workbench by following the explanation at the Eclipse Import XML catalog section (hint: use the Eclipse Import/XML feature). Note also that the platform:/resource notation is used to identify a resource located in the workspace. The next path segment after "resource" should be the name of a project, which can be followed by the folder and/or file we want to locate. So you might need to change the workspase name part of the path according to your real project name.

Here is an example

 

Eclipse and Gradle

A gradle plug-in exist for eclipse and it is  in the default configuration for the last version of eclipse.

With this plug-in and declare ofbiz as a gradle project, it's possible to view the task list and running them directly by a click, but currently it's not easy to give some parameters values. So it's useful for the basic tasks but not for a full usage of gradle. If you only have a graphical view for the task list, it's more simple to just do (out of eclipse ;-) ./gradlew --gui

After this warning, if you continue to realy want to have ofbiz declare as a Gradle project, you should do 2 steps :

  1. STEP-1 : If you have'nt generate eclipse file (./gradlew eclipse), my advice is to modifying build.gradle before using
    add these lines :
    eclipse {
            project {
              //Eclipse project's comment which appair in Gradle tasks view behind ofbiz
              comment = 'All the main gradle task'
              //Append gradle natures :
              natures 'org.eclipse.buildship.core.gradleprojectnature'
              //Append the gradle build command:
              buildCommand 'org.eclipse.buildship.core.
    
    gradleprojectbuilder'
    
     
  2. STEP-1b : If you have already generate the eclipse file, the .project file should be modified
    You should add two thing :

    1. in <natures> add
              <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
    2. in <buildSpec>
              <buildCommand>
                  <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
                  <arguments/>
              </buildCommand>
  3. STEP-2 : (after the eclipse files generation) you should add a file name org.eclipse.buildship.core.prefs in .settings directory (created by gradle eclipse task)
    the contents of the file should be :

                 build.commands=org.eclipse.jdt.core.javabuilder
                 connection.arguments=
                 connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
                 connection.java.home=null
                 connection.jvm.arguments=
                 connection.project.dir=
                 derived.resources=.gradle,build
                 eclipse.preferences.version=1
                 natures=org.eclipse.jdt.core.javanature
                 project.path=\:

     

  4. You can start eclipse and wait init. You can go to the gradle task view

  5. last warning : do nut use, the eclipse option "convert to gradle project" because it generate a lot of subproject and an error in build path for ofbiz project.

     

  • No labels