beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aviem Zur (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (BEAM-1840) shaded classes are not getting into the proper package
Date Fri, 31 Mar 2017 14:51:42 GMT

    [ https://issues.apache.org/jira/browse/BEAM-1840?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15951050#comment-15951050
] 

Aviem Zur edited comment on BEAM-1840 at 3/31/17 2:51 PM:
----------------------------------------------------------

The relocation rules are based on the artifact ids, and not the package names.
{code:xml}
<shadedPattern>
  org.apache.${renderedArtifactId}.repackaged.com.google.common
</shadedPattern>
{code}
The way we calculate {{renderedArtifactId}} is replacing non-alphanumeric characters in the
artifact id with {{.}}
{code:xml}
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>3.0.0</version>
  <executions>
    <execution>
      <id>render-artifact-id</id>
      <goals>
        <goal>regex-properties</goal>
      </goals>
      <phase>prepare-package</phase>
      <configuration>
        <regexPropertySettings>
          <regexPropertySetting>
            <name>renderedArtifactId</name>
            <regex>[^A-Za-z0-9]</regex>
            <replacement>.</replacement>
            <value>${project.artifactId}</value>
            <failIfNoMatch>false</failIfNoMatch>
          </regexPropertySetting>
        </regexPropertySettings>
      </configuration>
    </execution>
  </executions>
</plugin>
{code}
If we want the relocated classes to be in the {{sdk}} package instead of {{sdks}} package
what needs to be done is add another replacement on {{renderedArtifactId}} which will replace
{{sdks}} with {{sdk}}.


was (Author: aviemzur):
The relocation rules are based on the artifact ids, and not the package names.
{{code}}
<shadedPattern>
  org.apache.${renderedArtifactId}.repackaged.com.google.common
</shadedPattern>
{{code}}
The way we calculate {{renderedArtifactId}} is replacing non-alphanumeric characters in the
artifact id with {{.}}
{{code}}
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>3.0.0</version>
  <executions>
    <execution>
      <id>render-artifact-id</id>
      <goals>
        <goal>regex-properties</goal>
      </goals>
      <phase>prepare-package</phase>
      <configuration>
        <regexPropertySettings>
          <regexPropertySetting>
            <name>renderedArtifactId</name>
            <regex>[^A-Za-z0-9]</regex>
            <replacement>.</replacement>
            <value>${project.artifactId}</value>
            <failIfNoMatch>false</failIfNoMatch>
          </regexPropertySetting>
        </regexPropertySettings>
      </configuration>
    </execution>
  </executions>
</plugin>
{{code}}
If we want the relocated classes to be in the {{sdk}} package instead of {{sdks}} package
what needs to be done is add another replacement on {{renderedArtifactId}} which will replace
{{sdks}} with {{sdk}}.

> shaded classes are not getting into the proper package
> ------------------------------------------------------
>
>                 Key: BEAM-1840
>                 URL: https://issues.apache.org/jira/browse/BEAM-1840
>             Project: Beam
>          Issue Type: Improvement
>          Components: build-system
>            Reporter: Ismaël Mejía
>            Assignee: Ismaël Mejía
>            Priority: Trivial
>
> The current shade configuration relocates classes into packages based in the artifact
name, however this is inconsistent with the package nams because the beam artifact ids follow
the directory structure beam-sdks-java-io-* but the package structure is beam/sdk/java/io
so there is an extra 's' that creates a different package.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message