-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Add support for includeGroupIds
#12813
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
Conversation
|
@vision-ken we'd like to understand why you need this feature. Can you please provide more details? |
|
@snicoll Now I have a spring cloud project which has many of own business maven modules, these modules need to package into "fat JAR", because they change often. If <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
<excludeGroupIds>
io.prong,
io.prong.boot,
io.prong.cloud
</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layout>ZIP</layout>
<includes>
<include>
<groupId>io.prong</groupId>
<artifactId>aaaa</artifactId>
</include>
<include>
<groupId>io.prong</groupId>
<artifactId>bbbb</artifactId>
</include>
...
<include>
<groupId>io.prong.boot</groupId>
<artifactId>cccc</artifactId>
</include>
<include>
<groupId>io.prong.boot</groupId>
<artifactId>dddd</artifactId>
</include>
...
<include>
<groupId>io.prong.cloud</groupId>
<artifactId>eeee</artifactId>
</include>
<include>
<groupId>io.prong.cloud</groupId>
<artifactId>ffff</artifactId>
</include>
...
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>Every time the artifactIds under groupIds So, if <build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<excludeTransitive>false</excludeTransitive>
<stripVersion>false</stripVersion>
<includeScope>runtime</includeScope>
<excludeGroupIds>
io.prong,
io.prong.boot,
io.prong.cloud
</excludeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>
<configuration>
<layout>ZIP</layout>
<includeGroupIds>
io.prong,
io.prong.boot,
io.prong.cloud
</includeGroupIds>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>I don't need to change the pom any more, because |
snicoll
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, that looks pretty complete. I can see that you've extended the initial scope to also include artifactIds.
This made me realize we should not promote the latter any further. I've created #12885. Can you please review your PR to remove that part and only focus on includeGroupIds?
includeGroupIds, includeArtifactIds Maven-PluginincludeGroupIds
|
@snicoll done :) |
|
I've polished the PR and it's ready to go but I am not sure we should merge it. The purpose of exclude is to be able to remove things that should not be part of the app (while being present in the pom). An important part of this is that it also applies to the classpath we use to run the app. So, say you have Now, if we introduce this parameter things go sideways. It is a corner case to create a fat jar that can't run on its own (it needs an extra lib directory with stuff that are shared or some loader config). If we merge this, then users won't be able to use |
|
@nosan thanks a lot for the PR but we've decided not to add that feature for the reasons exposed above. @vision-ken if you want to repackage your jar in such a way that it can't run without additional libs, please have a look to custom layout. |
|
@snicoll it's ok, you know much better should it be merged or not, if you feel that feature will bring some sideways, it's much better not to add it at all IMO. |
|
Excuse me, how to solve the above problem |
I don't think |
|
插件应该提供最大的灵活性。不限制使用方式, includeGroupIds 明显比 includes 更实用。 |
@iamnewsea <build>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
<plugin>
<groupId>icu.easyj.maven.plugins</groupId>
<artifactId>easyj-maven-plugin</artifactId>
<version>1.0.9</version>
<executions>
<execution>
<id>spring-boot-extend</id>
<phase>prepare-package</phase>
<goals>
<goal>spring-boot-extend</goal>
</goals>
<configuration>
<includeGroupIds>groupA, groupB, groupC</includeGroupIds>
</configuration>
</execution>
</executions>
</plugin>
</build> |
|
@wangliang181230 牛逼! |
see gh-12794.