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

[BEAM-2242] Ensure that jars are shaded correctly by running the jar plugin before the shade plugin #3034

Closed
wants to merge 5 commits into from

Conversation

lukecwik
Copy link
Member

@lukecwik lukecwik commented May 10, 2017

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify.
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

This required listing the maven jar plugin earlier within the file so that the jar/test jar ran before shade within the package phase.

I also update the maven shade plugin version in archetypes to pickup the fixes in the service file transformer and dropped the usage of finalName in the shade plugin so all artifacts are named the same way.

This required listing the maven jar plugin earlier within the file so that the jar/test jar ran before shade within the package phase.

I also update the maven shade plugin version in archetypes to pickup the fixes in the service file transformer and dropped the usage of finalName in the shade plugin so all artifacts are named the same way.
@lukecwik
Copy link
Member Author

R: @davorbonaci

@lukecwik
Copy link
Member Author

retest this please

Copy link
Member

@davorbonaci davorbonaci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, maven-jar-plugin is duplicated in so many places. Given this duplication, I think I prefer the other approach -- binding it just before the package phase.

@lukecwik
Copy link
Member Author

The maven-jar-plugin is not bound everywhere, its only bound in the modules which have maven-shade-plugin and its also excluded in sdks/java/maven-archetypes parent

@lukecwik
Copy link
Member Author

R: @kennknowles @davorbonaci passes on my desktop now

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.09%) to 70.387% when pulling 93f01d4 on lukecwik:beam2242 into e2be696 on apache:master.

<!-- Ensure that the Maven jar plugin runs before the Maven
shade plugin by listing the plugin higher within the file. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we moved the overrides on the shade plugin to pluginManagement then would the ordering from the parent automatically fix all the submodules?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might, but maven docs only say that the execution order of plugins is based first on phase order and then within a single phase it depends on the order in which they are defined in plugns. It doesn't say anything about pluginManagement affecting order. It also says that the order is inherited from parent modules but it is unclear as to what happens if I declare conflicting orders within a child module or just redefine the same plugin within a child module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that the fact that we configured the shade plugin in the plugins area is a bug. It cause the order to be changed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@kennknowles kennknowles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Despite my comment about possible alternatives, doing the expedient thing is better right now. I like how surgical this change is.

Plus, even the best possible config is not going to be particularly clean, and I'd even argue that the inheritance just muddles readability while coupling things that don't need to be.

@lukecwik lukecwik changed the title [BEAM-2242] Ensure that the test jar is shaded correctly [BEAM-2242] Ensure that jars are shaded correctly by running the jar plugin before the shade plugin May 10, 2017
@asfgit asfgit closed this in 16e4c74 May 10, 2017
<!--
Configures `mvn package` to produce a bundled jar ("fat jar") for runners
that require this for job submission to a cluster.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<version>3.0.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for later: why is this here at all?

Should be managed in root pom.xml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the generated pom.xml which we should be able to improve by having a tool set the versions based upon the ones defined within the parent pom

Filed https://issues.apache.org/jira/browse/BEAM-2253

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to get rid of the shading or keep it, filed https://issues.apache.org/jira/browse/BEAM-2251

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants