maven dependency scope for mojo exec:java

I want to run a local activemq broker for jmeter tests with:

mvn exec:java -PJMeterProfile

I have some deps in provided scope, causing java.lang.NoClassDefFoundError, like

            <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                    <version>1.6.4</version>
                    <scope>provided</scope>
            </dependency>
            <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>1.6.4</version>
                    <scope>provided</scope>
            </dependency>
            <dependency>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                    <version>1.2.17</version>
                    <scope>provided</scope>
            </dependency>

Is there some scope apropriated to maven provide this classes only for exec:java? Or how other way to provide this dependency only in exec:java?

Resolved adding dependency to mojo plugin like sugested by tom ( and adding includePluginDependencies true ):

                    <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>exec-maven-plugin</artifactId>
                            <configuration>
                                    <mainClass>${target.main.class}</mainClass>
                                    <commandlineArgs>${target.cmd.args}</commandlineArgs>
                                    <includePluginDependencies>true</includePluginDependencies>
                            </configuration>
                            <dependencies>
                                    <dependency>
                                            <groupId>org.slf4j</groupId>
                                            <artifactId>slf4j-api</artifactId>
                                            <version>1.6.4</version>
                                            <scope>compile</scope>
                                    </dependency>
                                    <dependency>
                                            <groupId>org.slf4j</groupId>
                                            <artifactId>slf4j-log4j12</artifactId>
                                            <version>1.6.4</version>
                                            <scope>compile</scope>
                                    </dependency>
                                    <dependency>
                                            <groupId>log4j</groupId>
                                            <artifactId>log4j</artifactId>
                                            <version>1.2.17</version>
                                            <scope>compile</scope>
                                    </dependency>
                            </dependencies>
                    </plugin>

Answers


I believe you can add the dependencies to the plugin itself. That way they are added when the plugin is executed.

Check out this url.


Need Your Help

Download A File At Different Location Using HTML5

javascript html html5 download

I am downloading files using HTML5 from below codes that you can see live in action at JSBIN HTML5 Download File DEMO and its working perfectly file and downloading my files at my browser default

Intranet back-office data on the webserver?

php database security

I am upgrading a client's e-commerce webstore and have hit a bit of a snag.