OpenJPA
  1. OpenJPA
  2. OPENJPA-374

OpenJPA build process enhances Entity classes even when testing is deactivated via -Dtest=false

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0.3, 1.1.0
    • Component/s: build / infrastructure
    • Labels:
      None

      Description

      $ mvn package -Dtest=false
      attempts to enhance all the known Entity classes.
      It should not.

        Activity

        Donald Woods made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Michael Dick made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 1.0.3 [ 12312969 ]
        Fix Version/s 1.1.0 [ 12312344 ]
        Michael Dick made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Michael Dick added a comment -

        The fix I came up with is similar to the one for OPENJPA-512.

        In short the idea is to have an ant target that won't execute if $

        {test}=false or if ${maven.test.skip}=true. To do that I pulled the ant task out of pom.xml and created the enhancer.xml file which contains two targets :

        "enhance" which only runs if ${test}

        !=false
        "enhance.all.entities" which runs if $

        {maven.test.skip}

        !=true.

        enhance calls enhance.all.entities, which actually calls the enhancer. As I understand it you have to create multiple targets if you want to do something like this in ant - it's not really meant to be a scripting language.

        Show
        Michael Dick added a comment - The fix I came up with is similar to the one for OPENJPA-512 . In short the idea is to have an ant target that won't execute if $ {test}=false or if ${maven.test.skip}=true. To do that I pulled the ant task out of pom.xml and created the enhancer.xml file which contains two targets : "enhance" which only runs if ${test} !=false "enhance.all.entities" which runs if $ {maven.test.skip} !=true. enhance calls enhance.all.entities, which actually calls the enhancer. As I understand it you have to create multiple targets if you want to do something like this in ant - it's not really meant to be a scripting language.
        Michael Dick made changes -
        Field Original Value New Value
        Assignee Michael Dick [ mikedd ]
        Hide
        Patrick Linskey added a comment -

        FTR, the build scripts attempt to run the enhancer against all entity classes except those that start with 'Unenhanced'.

        This fact is probably unrelated to this JIRA issue, which was probably filed because OpenJPA should ideally not be running the enhancer at all in certain configurations. But, if you are looking for a way to store a class that should fail to enhance, then you can name it 'Unenhanced<Something>'.

        Also, note that I imagine it'll be a bit tricky to decouple the enhancer in an optimal way. I believe that the -Dtest=false thing is a bit of a hack (recall that you can also do -Dtest=MyTestClassName), so probably has nothing to do with mvn build phases.

        Show
        Patrick Linskey added a comment - FTR, the build scripts attempt to run the enhancer against all entity classes except those that start with 'Unenhanced'. This fact is probably unrelated to this JIRA issue, which was probably filed because OpenJPA should ideally not be running the enhancer at all in certain configurations. But, if you are looking for a way to store a class that should fail to enhance, then you can name it 'Unenhanced<Something>'. Also, note that I imagine it'll be a bit tricky to decouple the enhancer in an optimal way. I believe that the -Dtest=false thing is a bit of a hack (recall that you can also do -Dtest=MyTestClassName), so probably has nothing to do with mvn build phases.
        Pinaki Poddar created issue -

          People

          • Assignee:
            Michael Dick
            Reporter:
            Pinaki Poddar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development