JiBX
  1. JiBX
  2. JIBX-246

Change location of JiBX configuration directory to .project file

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: JiBX 1.1.6
    • Fix Version/s: None
    • Component/s: eclipse-plugin
    • Labels:
      None
    • Number of attachments :
      1

      Description

      Our projects are held under source control (clearcase in our case).
      The current JiBX eclipse plugin's configuration information is split into 2 places. The mapping folder location is held as part of the workspace and the project nature is held as part of the .project file.
      This means that we can not import the project into eclipse as a single step - i.e. after importing the project we must explicitly set the mapping folder by hand.

      Please can you store the JiBX configuration as part of the project's nature (or somewhere in the .project/.classpath files).

        Activity

        Hide
        David Newcomb added a comment -

        Perhaps storing it in the buildCommand (inside the .project) might be a better idea.
        You already have:

        <buildCommand>
        <name>org.jibx.eclipse.JibxBindingBuilder</name>
        <arguments>
        </arguments>
        </buildCommand>

        so hopefully its not too much extra work to change it to:

        <buildCommand>
        <name>org.jibx.eclipse.JibxBindingBuilder</name>
        <arguments>
        <argument name="location">/path/to/dir</argument>
        <argument name="verbose">true</argument>
        </arguments>
        </buildCommand>

        Show
        David Newcomb added a comment - Perhaps storing it in the buildCommand (inside the .project) might be a better idea. You already have: <buildCommand> <name>org.jibx.eclipse.JibxBindingBuilder</name> <arguments> </arguments> </buildCommand> so hopefully its not too much extra work to change it to: <buildCommand> <name>org.jibx.eclipse.JibxBindingBuilder</name> <arguments> <argument name="location">/path/to/dir</argument> <argument name="verbose">true</argument> </arguments> </buildCommand>
        Hide
        Cheng Lee added a comment -

        I've attached a patched version for your review which would let build commands support arguments. The relevant part is in method JibxBindingBuilder#build(int kind, Map args, IProgressMonitor monitor):

        jibxMappingsFolder = project.getPersistentProperty(new QualifiedName("",
        JibxPropertyPage.JIBX_SOURCE_FOLDER_PROPERTY));

        ... patch code begins

        // See if we have buildCommand argument named "jibxMappingsFolder". If so, use it
        if (args != null) {
        String mappingsFolder = (String) args.get("jibxMappingsFolder");
        if (mappingsFolder != null)

        { jibxMappingsFolder = mappingsFolder; }

        }

        ... patch code ends

        if (null == jibxMappingsFolder)

        { jibxMappingsFolder = JibxPropertyPage.DEFAULT_FOLDER; }

        The priorities become:
        1) build command arguments
        2) eclipse workspace persistence store
        3) JibxPropertyPage.DEFAULT_FOLDER

        I think this is appropriate for my project since we build from maven and generate .project files with build command arguments. I hope this works for you guys

        Show
        Cheng Lee added a comment - I've attached a patched version for your review which would let build commands support arguments. The relevant part is in method JibxBindingBuilder#build(int kind, Map args, IProgressMonitor monitor): jibxMappingsFolder = project.getPersistentProperty(new QualifiedName("", JibxPropertyPage.JIBX_SOURCE_FOLDER_PROPERTY)); ... patch code begins // See if we have buildCommand argument named "jibxMappingsFolder". If so, use it if (args != null) { String mappingsFolder = (String) args.get("jibxMappingsFolder"); if (mappingsFolder != null) { jibxMappingsFolder = mappingsFolder; } } ... patch code ends if (null == jibxMappingsFolder) { jibxMappingsFolder = JibxPropertyPage.DEFAULT_FOLDER; } The priorities become: 1) build command arguments 2) eclipse workspace persistence store 3) JibxPropertyPage.DEFAULT_FOLDER I think this is appropriate for my project since we build from maven and generate .project files with build command arguments. I hope this works for you guys
        Hide
        Cheng Lee added a comment - - edited

        BTW, if you want to use maven2 to generate the .project you should add this to your pom.xml:

        <!-- Eclipse -->
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <version>2.7</version>
        <configuration>
        <additionalBuildcommands>
        <buildCommand>
        <name>org.jibx.eclipse.JibxBindingBuilder</name>
        <arguments>
        <jibxMappingsFolder>path/to/dir</jibxMappingsFolder>
        </arguments>
        </buildCommand>
        </additionalBuildcommands>
        <additionalProjectnatures>
        <projectnature>org.jibx.eclipse.JibxNature</projectnature>
        </additionalProjectnatures>
        </configuration>
        </plugin>

        Note the syntax, it's not <argument name="key">value</argument> but <key>value</key>

        Show
        Cheng Lee added a comment - - edited BTW, if you want to use maven2 to generate the .project you should add this to your pom.xml: <!-- Eclipse --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.7</version> <configuration> <additionalBuildcommands> <buildCommand> <name>org.jibx.eclipse.JibxBindingBuilder</name> <arguments> <jibxMappingsFolder>path/to/dir</jibxMappingsFolder> </arguments> </buildCommand> </additionalBuildcommands> <additionalProjectnatures> <projectnature>org.jibx.eclipse.JibxNature</projectnature> </additionalProjectnatures> </configuration> </plugin> Note the syntax, it's not <argument name="key">value</argument> but <key>value</key>

          People

          • Assignee:
            Unassigned
            Reporter:
            David Newcomb
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: