You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Arnaud bourree <ar...@gmail.com> on 2020/10/07 10:00:06 UTC

Issue with assembly file-aggregator container descriptor hangler

Hello,

I want to aggregate yaml files from my dependencies.
I did for the pom.xml:
<project>
...
<dependencies>
  <dependency>
    <group>com.acme</group>
    <artifactId>dep-a</artifactId>
    <version>1.0</version>
    <classifier>info</classifier>
    <type>yaml</type>
  <dependency>
  <dependency>
    <group>com.acme</group>
    <artifactId>dep-b</artifactId>
    <version>1.0</version>
    <classifier>info</classifier>
    <type>yaml</type>
  <dependency>
  ...
</dependencies>
...
<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-dependency-plugin</artifactId>
      <version>3.1.2</version>
      <executions>
        <execution>
           <id>get-infos</id>
           <goals>
             <goal>copy-dependencies</goal>
           </goals>
           <phase>compile</phase>
           <configuration>
              <includeGroupIds>com.acme</includeGroupIds>
              <includeTypes>yaml</includeTypes>
              <includeClassifiers>info</includeClassifiers>

<outputDirectory>${project.build.directory}/infos</outputDirectory>
            </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-assembly-plugin</artifactId>
      <version>3.3.0</version>
      <executions>
        <execution>
          <id>build-infos</id>
          <goals>
            <goal>single</goal>
          </goals>
          <phase>prepare-package</phase>
          <configuration>
            <descriptors>
              <descriptor>assemblies/infos-yaml.xml</descriptor>
            </descriptors>
          </configuration>
        </execution>
    <plugin>
    ...
  </plugins>
</build>

and for the assembly:
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
http://maven.apache.org/ASSEMBLY/2.1.0
http://maven.apache.org/xsd/assembly-2.1.0.xsd">
    <id>infos</id>
    <formats>
        <format>dir</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>target/infos/</directory>
            <outputDirectory/>
        </fileSet>
    </fileSets>
    <containerDescriptorHandlers>
        <containerDescriptorHandler>
            <handlerName>file-aggregator</handlerName>
            <configuration>
                <filePattern>.*-info.yaml</filePattern>
                <outputPath>infos.yaml</outputPath>
            </configuration>
        </containerDescriptorHandler>
    </containerDescriptorHandlers>
</assembly>

In generated dir, no info.yaml in and as expected infos.yaml. But doesn't
contain info.yaml file content from dep-a nor dep-b.
If I specify dep-a in handler's fiePattern: .*dep-a-1.0-info.yaml, then I
get dep-b-1.0-info.yaml in generated dir, and infos.yaml still not contains
dep-a-1.0_info.yaml.
From the 2nd run, I understand that the handler process dep-a-1.0-info.yaml
file but why didn't it paste content in destination file?

Any body has idea?

Regards,

Arnaud

Re: Issue with assembly file-aggregator container descriptor hangler

Posted by Arnaud bourree <ar...@gmail.com>.
Issue is already known MASSEMBLY-815
<https://issues.apache.org/jira/browse/MASSEMBLY-815>
Workaround is adding metaInf-services handler:
    <containerDescriptorHandlers>
        </containerDescriptorHandler<containerDescriptorHandler>
          <handlerName>metaInf-services</handlerName>
        </containerDescriptorHandler>
        <containerDescriptorHandler>
            <handlerName>file-aggregator</handlerName>
            <configuration>
                <filePattern>.*-info.yaml</filePattern>
                <outputPath>infos.yaml</outputPath>
            </configuration>
        </containerDescriptorHandler>

Regards,

Arnaud

Le mer. 7 oct. 2020 à 12:00, Arnaud bourree <ar...@gmail.com> a
écrit :

> Hello,
>
> I want to aggregate yaml files from my dependencies.
> I did for the pom.xml:
> <project>
> ...
> <dependencies>
>   <dependency>
>     <group>com.acme</group>
>     <artifactId>dep-a</artifactId>
>     <version>1.0</version>
>     <classifier>info</classifier>
>     <type>yaml</type>
>   <dependency>
>   <dependency>
>     <group>com.acme</group>
>     <artifactId>dep-b</artifactId>
>     <version>1.0</version>
>     <classifier>info</classifier>
>     <type>yaml</type>
>   <dependency>
>   ...
> </dependencies>
> ...
> <build>
>   <plugins>
>     <plugin>
>       <groupId>org.apache.maven.plugins</groupId>
>       <artifactId>maven-dependency-plugin</artifactId>
>       <version>3.1.2</version>
>       <executions>
>         <execution>
>            <id>get-infos</id>
>            <goals>
>              <goal>copy-dependencies</goal>
>            </goals>
>            <phase>compile</phase>
>            <configuration>
>               <includeGroupIds>com.acme</includeGroupIds>
>               <includeTypes>yaml</includeTypes>
>               <includeClassifiers>info</includeClassifiers>
>
> <outputDirectory>${project.build.directory}/infos</outputDirectory>
>             </configuration>
>         </execution>
>       </executions>
>     </plugin>
>     <plugin>
>       <groupId>org.apache.maven.plugins</groupId>
>       <artifactId>maven-assembly-plugin</artifactId>
>       <version>3.3.0</version>
>       <executions>
>         <execution>
>           <id>build-infos</id>
>           <goals>
>             <goal>single</goal>
>           </goals>
>           <phase>prepare-package</phase>
>           <configuration>
>             <descriptors>
>               <descriptor>assemblies/infos-yaml.xml</descriptor>
>             </descriptors>
>           </configuration>
>         </execution>
>     <plugin>
>     ...
>   </plugins>
> </build>
>
> and for the assembly:
> <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/ASSEMBLY/2.1.0
> http://maven.apache.org/xsd/assembly-2.1.0.xsd">
>     <id>infos</id>
>     <formats>
>         <format>dir</format>
>     </formats>
>     <includeBaseDirectory>false</includeBaseDirectory>
>     <fileSets>
>         <fileSet>
>             <directory>target/infos/</directory>
>             <outputDirectory/>
>         </fileSet>
>     </fileSets>
>     <containerDescriptorHandlers>
>         <containerDescriptorHandler>
>             <handlerName>file-aggregator</handlerName>
>             <configuration>
>                 <filePattern>.*-info.yaml</filePattern>
>                 <outputPath>infos.yaml</outputPath>
>             </configuration>
>         </containerDescriptorHandler>
>     </containerDescriptorHandlers>
> </assembly>
>
> In generated dir, no info.yaml in and as expected infos.yaml. But doesn't
> contain info.yaml file content from dep-a nor dep-b.
> If I specify dep-a in handler's fiePattern: .*dep-a-1.0-info.yaml, then I
> get dep-b-1.0-info.yaml in generated dir, and infos.yaml still not contains
> dep-a-1.0_info.yaml.
> From the 2nd run, I understand that the handler process
> dep-a-1.0-info.yaml file but why didn't it paste content in destination
> file?
>
> Any body has idea?
>
> Regards,
>
> Arnaud
>