Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added goal [fmc], support to find main class and set to specified property #27855

Closed
wants to merge 2 commits into from

Conversation

kerwin612
Copy link

  • 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>

@pivotal-cla
Copy link

@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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Sep 2, 2021
@pivotal-cla
Copy link

@kerwin612 Thank you for signing the Contributor License Agreement!

@philwebb
Copy link
Member

philwebb commented Sep 3, 2021

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.

@philwebb philwebb closed this Sep 3, 2021
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged labels Sep 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants