////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////

One profile can extend one or many different parent profiles. To define profile inheritance you can modify the `build.gradle` of a profile and define the profile dependences. For example typically you want to extend the `base` profile:

[source,groovy]
----
dependencies {
    profileRuntimeApi "org.apache.grails.profiles:base:{version}"
}
----

By inheriting from a parent profile you get the following benefits:

* When the link:{commandLineRef}create-app.html[create-app] command is executed the parent profile's skeleton is copied first
* Dependencies and `build.gradle` is merged from the parent(s)
* The `application.yml` file is merged from the parent(s)
* CLI commands from the parent profile are inherited
* Features from the parent profile are inherited

To define the order of inheritance ensure that your dependencies are declared in the correct order. For example:

[source,groovy]
----
dependencies {
    profileRuntimeApi "org.apache.grails.profiles:plugin:$baseProfileVersion"
    profileRuntimeApi "org.apache.grails.profiles:web:$baseProfileVersion"
}
----

In the above snippet the skeleton from the "plugin" profile is copied first, followed by the "web" profile. In addition, the "web" profile overrides commands from the "plugin" profile, whilst if the dependency order was reversed the "plugin" profile would override the "web" profile.
