Topic
8 replies Latest Post - ‏2012-11-29T22:47:48Z by SystemAdmin
SystemAdmin
SystemAdmin
14225 Posts
ACCEPTED ANSWER

Pinned topic RBU is including .svn folders in jars

‏2012-11-29T16:41:00Z |
I'm using Rational Build Utility 8.0.4 in Linux (RHEL 6). I'm trying to build a EAR file which contains a web application and some web app libraries that are built from other projects in the workspace. I use RSA 8.0.4 to develop the application but want to build the EAR file on a separate Linux server, pulling the project files from Subversion which I'm doing in the shell script before invoking RBU.

RBU will build the EAR but the web app libraries (in the form of jars) contain the .svn folders from the src folder of the project. I can see in the Linux file manager that the build output folder (e.g. bin) contains the .svn folders so that explains why I see them in the project jar. However, RBU should not be copying the .svn folders from the src folder into the build output folder. Ant maintains a list of defaultExcludes which means Ant will not process files matching the patterns defined in defaultExcludes. I can verify that the .svn folders are defined in defaultExcludes:

<defaultexcludes echo=
"true"/>   [defaultexcludes] Current Default Excludes: [defaultexcludes]   **
/*~ [defaultexcludes]   **/#*# [defaultexcludes]   **/.#* [defaultexcludes]   **/%*% [defaultexcludes]   **/._* [defaultexcludes]   **/CVS [defaultexcludes]   **/CVS
/** [defaultexcludes]   **/.cvsignore [defaultexcludes]   **/SCCS [defaultexcludes]   **/SCCS
/** [defaultexcludes]   **/vssver.scc [defaultexcludes]   **/.svn [defaultexcludes]   **/.svn
/** [defaultexcludes]   **/.DS_Store

So why is RBU including the .svn folders in the build output folder? If I try to delete these folders myself during the build, the EAR file won't be built even though the earExport task completes successfully.

Here is the task that builds one of the web app libraries that has the .svn folders in the output jar:

<projectBuild projectName=
"App_Domain" buildType=
"Full"     disableValidators=
"true"/>

Here is the RBU output for this task:

[projectBuild] ... subtask: Refreshing 
'/App_Domain'. [projectBuild] ... subtask: Invoking 
'Faceted Project Validation Builder' on 
'/App_Domain'. [projectBuild] ... subtask: Invoking 
'Java Builder' on 
'/App_Domain'. [projectBuild] ... subtask: Preparing to build App_Domain [projectBuild] ... subtask: Cleaning output folder 

for App_Domain [projectBuild] ... subtask: Copying resources to the output folder [projectBuild] ... subtask: Analyzing sources [projectBuild] ... subtask: Compiling App_Domain/src/com/<removed>/domain/util [projectBuild] ... subtask: (Found 1 warning) Compiling App_Domain/src/com/<removed>/domain/util ... [projectBuild] ... subtask: (Found 10 warnings) Build done [projectBuild] ... subtask: Invoking 
'Validation' on 
'/App_Domain'. [projectBuild] The user operation is waiting 

for background work to complete. (Begin) [projectBuild] The user operation is waiting 

for background work to complete. (Done) [projectBuild] DONE.

Have I run into an RBU bug or am I missing something in my build file?
Updated on 2012-11-29T22:47:48Z at 2012-11-29T22:47:48Z by SystemAdmin
  • mattia
    mattia
    38 Posts
    ACCEPTED ANSWER

    Re: RBU is including .svn folders in jars

    ‏2012-11-29T17:54:41Z  in response to SystemAdmin
    Hi ,

    I know for a fact that the earExport task will also pull in the .svn folder. This is a current limitation, we are not able to exclude that folder from the export at this time.

    Seems to me though you are not performing an import with RBU. Are you importing the projects first through the projectImport Ant task? if not, please take a look at http://publib.boulder.ibm.com/infocenter/radhelp/v8/topic/com.ibm.ant.tasks.doc/topics/tantprojectimport.html. Hopefully importing each project before calling the build tasks will help.

    Let me know if not.
    • SystemAdmin
      SystemAdmin
      14225 Posts
      ACCEPTED ANSWER

      Re: RBU is including .svn folders in jars

      ‏2012-11-29T18:12:10Z  in response to mattia
      Hi mattia,

      I didn't have a projectImport for App_Domain so I have added one. However, this did not fix the problem. I still see the .svn folders in the build output folder for the project. Thanks for the suggestion though.

      I will note that in my shell script which does a checkout from Subversion and then calls <RBU>/bin/runAnt.sh, I do set the workspace variable to the Subversion project checkout folder. I thought projectImport was only needed if the project is not in the workspace directory? The projectImport documentation is pretty bare bones.
      • mattia
        mattia
        38 Posts
        ACCEPTED ANSWER

        Re: RBU is including .svn folders in jars

        ‏2012-11-29T18:23:51Z  in response to SystemAdmin
        You will need the projectImport in any case. Even if your project folders are already in your workspace folder.

        As expected, the problem will not be fixed just by this. Because our export task will not exclude the .svn folder as of now; it will include it.

        Maybe you could try work around this by using the Delete Ant task (http://ant.apache.org/manual/Tasks/delete.html) to delete the SVN folder from the project(s) before performing the earExport ?
    • SystemAdmin
      SystemAdmin
      14225 Posts
      ACCEPTED ANSWER

      Re: RBU is including .svn folders in jars

      ‏2012-11-29T18:24:13Z  in response to mattia
      If I add a task to delete the .svn folders from the build output directory for APP_Domain, the ear file will not be built by earExport even though the output says it did.

      
      <projectBuild projectName=
      "PIN_Domain" buildType=
      "Full"     disableValidators=
      "true"/> <delete includeemptydirs=
      "true"> <fileset dir=
      "${workspace}/APP_Domain/bin" includes=
      "**/.svn/" defaultexcludes=
      "false"/> </delete>   [earExport] Exporting project: APP_GUI_EAR (Begin) [earExport] ... subtask: Refreshing project: APP_GUI_EAR [earExport] ... subtask: Refreshing 
      '/APP_GUI_EAR'. [earExport] ... subtask: Refreshing 
      '/APP_GUI'. [earExport] ... subtask: Exporting archive 
      'APP_GUI_EAR.ear'. Refreshing 
      '/APP_GUI_EAR'. [earExport] ... subtask: Exporting archive 
      'APP_GUI_EAR.ear'. [earExport] ... subtask: Exporting archive 
      'APP_GUI_EAR.ear'. [earExport] EARExport completed to <home>/workspace/rbu/APP_GUI/build/ear/APP_GUI_EAR.ear
      
  • TroyBishop
    TroyBishop
    104 Posts
    ACCEPTED ANSWER

    Re: RBU is including .svn folders in jars

    ‏2012-11-29T20:23:02Z  in response to SystemAdmin
    Just to add on to what mattia mentioned, The EAR export functionality (in Rational Application Developer and Build Utility) does not allow for filtering of the content that is included in the resulting EAR file. There were a couple of RFE's opened for this functionality:

    RAD: Ability to exclude specific directory using the export EAR Ant task
    RBU: Ability to exclude specific directory using the export EAR Ant task

    but both have been rejected.

    As a side-note, The RBU functionality piggy-backs on RAD so this functionality would need to be in RAD before it is available in RBU.

    For the short-term there is no solution to remove the SVN content from the EAR file if you make use of the RBU earExport task. For the long-term, my only suggestion would be to request that this enhancement be re-opened.

    -Troy
    • SystemAdmin
      SystemAdmin
      14225 Posts
      ACCEPTED ANSWER

      Re: RBU is including .svn folders in jars

      ‏2012-11-29T21:20:46Z  in response to TroyBishop
      Thanks for the info Troy.

      It really wouldn't be a problem for me in the EAR export if the project build task didn't copy the .svn folders within the src tree to the build output folder. I can only guess that this is done when I see the "Copying resources to the output folder" message. Is this being done by Ant or some non-Ant RBU component? Since it doesn't seem to be honoring the defaultExcludes, I can only assume the latter.

      Also, when I deleted the .svn folders from the build output, why does the EAR export not actually create the EAR file although it implies it did?

      Is there some debug setting I can specify so RBU outputs more details on what it's doing? Perhaps it can shed some light on why it decides to copy the .svn folders or why the EAR file doesn't really get created.

      I guess I could delete the .svn folders after the checkout in my shell script. Drawback to that is a complete re-checkout of the source the next time I run the script.
      • TroyBishop
        TroyBishop
        104 Posts
        ACCEPTED ANSWER

        Re: RBU is including .svn folders in jars

        ‏2012-11-29T21:37:36Z  in response to SystemAdmin
        Hi,

        RBU is really meant to surface RAD (which is based on Eclipse) functionality as Ant tasks so the RBU specific tasks rarely honour other Apache Ant tasks. In Eclipse, when you do a build of a project then the Java builder will compile the source code into the output folder and also copy all non-Java related resources to the output folder. This is what you are seeing here. The SVN metadata files (in the source folders of your projects) are being copied to the output folder, and the RAD EAR exported blindly exports everything that is in the output folder of each project to the module file that is included in the resulting EAR.

        -Troy
        • SystemAdmin
          SystemAdmin
          14225 Posts
          ACCEPTED ANSWER

          Re: RBU is including .svn folders in jars

          ‏2012-11-29T22:47:48Z  in response to TroyBishop
          To throw more mystery into the pot, the .svn folders are only being copied for one particular web app library project being built. There are 5 web app library projects and the .svn folders are not being copied to the build output folders for the other 4 projects. Switching the order of the projectBuilds doesn't make any difference as the .svn folders are only copied for the one project. Very strange.