Announcement Announcement Module
Collapse
No announcement yet.
2.5.2 Grails: how to create a domain class in default package? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 2.5.2 Grails: how to create a domain class in default package?

    Even when I don't specify a class path in the new Domain Class name, STS creates it in the project name package, which doesn't make much sense to me. Maybe I am missing something.

  • #2
    fjanon,

    if you specify no package name Grails will default to the use the application name as the package name of the newly create class. This has nothing to do with STS and is Grails' intended behavior.

    Thanks, Christian

    Comment


    • #3
      Since grails has made this change, you can still create them directly in the default package if you prefix the name with '.'

      create-domain-class .Person

      Andy
      ---
      Andy Clement
      SpringSource

      Comment


      • #4
        generate-all command issue

        Hi,
        I am new to grails. the same thing goes for controllers for me.
        I have a domain class Users which was created in application name package by default
        If I use
        Code:
        create-controller Users
        command then the controllers are also placed in application name package. But if I use
        Code:
        generate-controller Users
        command then it says " No domain class found for name <Domain Class>"
        Please help me
        thanx
        Faheem

        Comment


        • #5
          Hi, this is the generated error log in grails, forgot to paste in last post
          User domain object is created in racetrack package by grails

          C:\opt\grails\web\racetrack>grails generate-all User
          Welcome to Grails 1.3.7 - http://grails.org/
          Licensed under Apache Standard License 2.0
          Grails home is set to: C:\opt\grails

          Base Directory: C:\opt\grails\web\racetrack
          Resolving dependencies...
          Dependencies resolved in 953ms.
          Running script C:\opt\grails\scripts\GenerateAll.groovy
          Environment set to development
          [groovyc] Compiling 1 source file to C:\opt\grails\web\racetrack\target\classe
          s
          [groovyc] Compiling 1 source file to C:\opt\grails\web\racetrack\target\classe
          s
          Domain class not found in grails-app/domain, trying hibernate mapped classes...
          [groovyc] Compiling 1 source file to C:\opt\grails\web\racetrack\target\classe
          s
          [groovyc] Compiling 1 source file to C:\opt\grails\web\racetrack\target\classe
          s
          No domain class found for name User. Please try again and enter a valid domain c
          lass name
          Application context shutting down...
          Application context shutdown.
          C:\opt\grails\web\racetrack>

          Comment


          • #6
            When you use generate-all or either of the other generate commands, you must use the fully qualified path name of the domain class that you want to generate for.

            Comment


            • #7
              thanx Andrew
              Its working now
              regards

              Faheem Ahmad

              Comment

              Working...
              X