OpenJPA
  1. OpenJPA
  2. OPENJPA-1628

Output control for generated canonical metamodel source code

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-beta3
    • Fix Version/s: 2.0.0
    • Component/s: jpa
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      I think, the way the JPA metamodel generator places the generated Java files, is flawed. I would have reopened OPENJPA-1187, if I had been able to.

      There should be no need to specify a proprietary switch ("openjpa.out") to specify the output dir. There is a switch '-s' to be used with javac to specify the output directory of the generated source files; see http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html. A proprietary switch should only be used as a fallback option for inconsistent java-implementations.

      Furthermore, the current approach does not play well with eclipse IDE annotation processing. The generated source files are placed under the eclipse installation directory. I can only prevent this, if I specify a fully qualified "out"-path. This is not feasible, as a project with these settings might be checked out to everywhere.
      The current approach with "setSourceOutputDirectory(new File(outDir))" seams only to be working by coincidence with relative paths (e.g with ant-javac).

        Issue Links

          Activity

          Hide
          Donald Woods added a comment -

          Checked into 2.0.x branch on 4/15/10 by Pinaki as r934511

          Show
          Donald Woods added a comment - Checked into 2.0.x branch on 4/15/10 by Pinaki as r934511
          Hide
          Kevin Sutter added a comment -

          Re-opening so that we can re-target this to get resolved in 2.0.0 (since we have to re-spin)...

          Show
          Kevin Sutter added a comment - Re-opening so that we can re-target this to get resolved in 2.0.0 (since we have to re-spin)...
          Hide
          Donald Woods added a comment -

          Setting Fix Version to 2.1.0, as changes have only been checked into trunk (2.1.0-SNAPSHOT)

          Show
          Donald Woods added a comment - Setting Fix Version to 2.1.0, as changes have only been checked into trunk (2.1.0-SNAPSHOT)
          Hide
          Frank Schwarz added a comment -

          I tested my patch under Sun JDK 1.6.0_18 with Ant 1.7.1 and with eclipse 3.5.2 (with the same JDK) - but with only a few model classes. The patch should still be tested with a somewhat larger amount of entity classes.

          Show
          Frank Schwarz added a comment - I tested my patch under Sun JDK 1.6.0_18 with Ant 1.7.1 and with eclipse 3.5.2 (with the same JDK) - but with only a few model classes. The patch should still be tested with a somewhat larger amount of entity classes.
          Hide
          Pinaki Poddar added a comment -

          Thanks Frank for the patch. I agree that the usage of existing "-s" or "-d" option to javac is the proper way to control the output rather than a redundant -Aout flag. As far as I recall, however, the values of -s/-d switches were not available consistently within the annotation processing environment – but I admit that I did not pay enough attention or research sufficiently to output control at the time of writing the processor.

          I will prefer to apply your patch. Will you please update us on which compilers have you tried the patch with?

          Show
          Pinaki Poddar added a comment - Thanks Frank for the patch. I agree that the usage of existing "-s" or "-d" option to javac is the proper way to control the output rather than a redundant -Aout flag. As far as I recall, however, the values of -s/-d switches were not available consistently within the annotation processing environment – but I admit that I did not pay enough attention or research sufficiently to output control at the time of writing the processor. I will prefer to apply your patch. Will you please update us on which compilers have you tried the patch with?
          Hide
          Frank Schwarz added a comment -

          "worksforme"-patch attached (the patch will break the "openjpa.out" property processing - which imho. should not be needed at all.)

          Show
          Frank Schwarz added a comment - "worksforme"-patch attached (the patch will break the "openjpa.out" property processing - which imho. should not be needed at all.)

            People

            • Assignee:
              Pinaki Poddar
              Reporter:
              Frank Schwarz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development