How do you define the Grails 3 app name so that it's part of the url?

741 views
Skip to first unread message

virtual dogbert

unread,
Jun 12, 2015, 10:09:23 AM6/12/15
to grails-de...@googlegroups.com
So from the documentation I see "The application name and version is now defined in build.gradle" but my question is where in the build.gradle should I define the application name, and what's the syntax of that.  The reason I want this is so that the URL will have that app name, which will be the same as the war name, so that I have the same url structure running locally, as I do running as a war.

for example my say my app name is groovyduke, when I run my app the url should be
localhost:8080/groovyduke/...
regardless of if I'm running in intellij or running as a war

Mihai Glonț

unread,
Jun 12, 2015, 10:13:55 AM6/12/15
to grails-de...@googlegroups.com
I was looking at this built script[1] just as you asked the question. Is this what you were looking for?

[1] https://github.com/grails/grails3-functional-tests/blob/master/app1/build.gradle#L19
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.
To post to this group, send email to grails-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grails-dev-discuss/65d4c27c-0fa2-4c66-b2cc-2ed4f6564738%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

virtual dogbert

unread,
Jun 12, 2015, 11:07:13 AM6/12/15
to grails-de...@googlegroups.com
No that's just the version and it has no effect on the url, what I'm asking about is the application name which was in application.properties, and in the documentation it was said to be moved to build.gradle, but it didn't say where or the syntax to defining it.


On Friday, June 12, 2015 at 10:13:55 AM UTC-4, Mihai Glonț wrote:
I was looking at this built script[1] just as you asked the question. Is this what you were looking for?

[1] https://github.com/grails/grails3-functional-tests/blob/master/app1/build.gradle#L19

On 12/06/15 15:09, virtual dogbert wrote:
So from the documentation I see "The application name and version is now defined in build.gradle" but my question is where in the build.gradle should I define the application name, and what's the syntax of that.  The reason I want this is so that the URL will have that app name, which will be the same as the war name, so that I have the same url structure running locally, as I do running as a war.

for example my say my app name is groovyduke, when I run my app the url should be
localhost:8080/groovyduke/...
regardless of if I'm running in intellij or running as a war
--
You received this message because you are subscribed to the Google Groups "Grails Dev Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-discuss+unsub...@googlegroups.com.

Mihai Glonț

unread,
Jun 12, 2015, 11:09:52 AM6/12/15
to grails-de...@googlegroups.com
That link was highlighting the wrong line - if you look at line 20, you see the groupId.
To unsubscribe from this group and stop receiving emails from it, send an email to grails-dev-disc...@googlegroups.com.

To post to this group, send email to grails-de...@googlegroups.com.

Jeff Scott Brown

unread,
Jun 12, 2015, 12:40:53 PM6/12/15
to grails-de...@googlegroups.com

> On Jun 12, 2015, at 10:09 AM, Mihai Glonț <mgl...@ebi.ac.uk> wrote:
>
> That link was highlighting the wrong line - if you look at line 20, you see the groupId.

Providing a link like that is problematic because the link won’t be valid over time as the file changes. Often better idea is to provide a link to the line of a specific version of the file. GitHub makes that really easy to do. When you load a page like https://github.com/grails/grails3-functional-tests/blob/master/app1/build.gradle in the browser press the “y” key on your keyboard which will take you to the latest version of the file. Then when you create a link to a line number like https://github.com/grails/grails3-functional-tests/blob/651622026d6b9b8f392334a324dea92508fbb157/app1/build.gradle#L20, even if the file changes after that, your link is still good and points to the right place.



JSB


Jeff Scott Brown
Principal Software Engineer
Grails Development Team
Object Computing Inc.
http://www.ociweb.com/

Autism Strikes 1 in 166
Find The Cause ~ Find The Cure
http://www.autismspeaks.org/

Mihai Glonț

unread,
Jun 12, 2015, 1:25:09 PM6/12/15
to grails-de...@googlegroups.com
you're right - thanks, Jeff!

virtual dogbert

unread,
Jun 12, 2015, 2:53:04 PM6/12/15
to grails-de...@googlegroups.com
The group doesn't seem to have any effect on the url. But setting server.'context-path' = '/groovyduke' in my application.groovy , like Naresha suggested worked.
Reply all
Reply to author
Forward
0 new messages