How to define a new kind of scope in Maven?

1.1k views Asked by At

In order tell the Flexmojo Maven plugin that your project should use a particular theme, it is necessary to add a scope "theme" dependency to your project like this:

            <dependency>
                    <groupId>com.adobe.flex.framework</groupId>
                    <artifactId>spark</artifactId>
                    <version>4.1.0.16076</version>
                    <type>swc</type>
                    <scope>theme</scope>
            </dependency>

This works fine, but produces the following scary looking warning:

[WARNING] Some problems were encountered while building the effective
model for com.mycorp.core:myapp-core-flex-client:swf:1.0.0-SNAPSHOT
[WARNING] 'dependencies.dependency.scope' for
com.adobe.flex.framework:spark:swc must be one of [provided, compile,
runtime, test, system] but is 'theme'. @ line 48, column 11
[WARNING]
[WARNING] It is highly recommended to fix these problems because they
threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer
support building such malformed projects.

Is there a way to add the new type of scope to Maven so it accepts it as legitimate? Or at least get rid of the warning?

1

There are 1 answers

2
Mark O'Connor On BEST ANSWER

The number of scopes in Maven is fixed, see the POM reference.