• Added goal [fmc], support to find main class and set to specified property.

Sometimes we use spring-boot, but do not want to use repackage. We use spring-boot, but still use maven-jar-plugin for packaging, and do not want manually entering main-class. spring-boot-maven-plugin supports automatic location main-class Ability, I just open it up only.

The following is a rough example:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <mainClassPropertyName>foundMainClass</mainClassPropertyName>
    </configuration>
</plugin>
<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <mainClass>${foundMainClass}</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>

Comment From: pivotal-cla

@kerwin612 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@kerwin612 Thank you for signing the Contributor License Agreement!

Comment From: philwebb

Thanks for the suggestion but Mojo doesn't feel quite right to me. It feels odd that FindMainClassMojo has all sorts of dependency filtering properties and also a little strange that AbstractRunMojo now extends a concrete mojo.

I'm not too keen to introduce a new goal just for this. I think the majority of our users are working with repackaged jars. I would suggest developing your own mojo that's specifically for this task. The MainClassFinder is part of spring-boot-loader-tools which you are free to depend on.