Maven Archetype
  1. Maven Archetype
  2. ARCHETYPE-162

Prepend java package declaration to the java file path

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-alpha-2
    • Fix Version/s: 2.0-alpha-5
    • Component/s: Creator
    • Labels:
      None
    • Number of attachments :
      0

      Description

      If I define a java class like that :

      package ${package}.another.package;
      
      public class AClass {
      ...
      }
      

      Then I would expect to see this class in folder src/main/java/$

      {package}/another/package
      and not in src/main/java/${package}

        Activity

        Hide
        Raphaël Piéroni added a comment - - edited

        Put your java class in
        src/main/resources/archetype-resources/src/main/java/another/package

        Show
        Raphaël Piéroni added a comment - - edited Put your java class in src/main/resources/archetype-resources/src/main/java/another/package
        Hide
        Bruno Bieth added a comment -

        Thanks, for the comment.
        Yes, that's fine as long as you don't use variable in the package declaration and you always add $

        {package} at the beginning.

        What if I want :

        package ${package}

        .$

        {artifactId}

        .apackage;

        Maybe nobody defines packages like that

        I know I'm picky but this would ensure that classes are in the right folder.
        Thanks

        Show
        Bruno Bieth added a comment - Thanks, for the comment. Yes, that's fine as long as you don't use variable in the package declaration and you always add $ {package} at the beginning. What if I want : package ${package} .$ {artifactId} .apackage; Maybe nobody defines packages like that I know I'm picky but this would ensure that classes are in the right folder. Thanks
        Hide
        Raphaël Piéroni added a comment -

        The fix for this issue is related to ARCHETYPE-192.
        If one has a java file like
        package $

        {package}

        .$

        {artifactId}

        .$

        {someProperty}

        ;
        class $

        {somePrefix}

        Model {};
        Just place it in /src/main/resources/archetype-resources/src/main/java/_artifactId/someProperty_
        And call it _somePrefix_Model.java
        And obviously use a 'packaged' fileset in your archeype-metadata.xml file

        Show
        Raphaël Piéroni added a comment - The fix for this issue is related to ARCHETYPE-192 . If one has a java file like package $ {package} .$ {artifactId} .$ {someProperty} ; class $ {somePrefix} Model {}; Just place it in /src/main/resources/archetype-resources/src/main/java/_ artifactId / someProperty _ And call it _ somePrefix _Model.java And obviously use a 'packaged' fileset in your archeype-metadata.xml file

          People

          • Assignee:
            Unassigned
            Reporter:
            Bruno Bieth
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: