karma-runner / maven-karma-plugin

Maven plugin for running tests using Karma.
Apache License 2.0
45 stars 26 forks source link

Plugin should run in the TEST phase by default #19

Closed NateRedding closed 10 years ago

NateRedding commented 10 years ago

Following the convention over configuration principle that Maven borrows heavily from, it would be nice if the maven-karma-plugin plugin would run without an <execution> tag being specified.

You can do this simply by adding the following annotation immediately after the @Mojo annotation:

@Execute(goal = "start", phase = LifecyclePhase.TEST)

NateRedding commented 10 years ago

This will shorten the configuration needed from:

        <plugin>
            <groupId>com.kelveden</groupId>
            <artifactId>maven-karma-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                ...
            </configuration>
        </plugin>

To:

        <plugin>
            <groupId>com.kelveden</groupId>
            <artifactId>maven-karma-plugin</artifactId>
            <version>1.6</version>
            <configuration>
                ...
            </configuration>
        </plugin>
kelveden commented 10 years ago

I've always liked explicitly specifying stuff in Maven mainly because I don't like the idea of implicit configuration. Having said that, what you suggest is such a no-brainer of a convention that I've no major issue with it. People like me can still explicitly specify the configuration if they so choose.

I'd be happy to merge a pull request in - it might take me a little while to get around to making the change myself right now.

NateRedding commented 10 years ago

Hmm... I was taking a look at this again today. I was apparently wrong about the ability to do this. I thought I had seen a plugin use @Execute to automatically run a specific goal, but it looks like I was wrong:

http://maven.40175.n5.nabble.com/Can-a-plugin-have-a-default-execution-goal-td108343.html https://stackoverflow.com/questions/7331646/maven-plugin-development-is-there-a-way-to-automatically-run-plugin-when-its-j

As such, I am closing this issue.