2013-04-18 8 views
5

Próbuję filtrować zasoby zawarte w moim słoiku. Używam shadow-maven-plugin, a ta dodaje wszystkie zasoby wszystkich moich zależności do mojego wygenerowanego słoika, chcę tylko dołączyć moje zasoby projektu.Filtruj zasoby maven-shade-plugin

Oto moja definicja pom:

<plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-shade-plugin</artifactId> 
      <version>1.6</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>shade</goal> 
        </goals> 
        <configuration> 
         <minimizeJar>true</minimizeJar> 
         <transformers> 
          <transformer 
           implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
           <mainClass>es.app.applet.MyApplet</mainClass> 
          </transformer> 
         </transformers> 
        </configuration> 
       </execution> 
      </executions> 
      <configuration> 
       <filters> 
        <filter> 
         <artifact>*:*</artifact> 
         <excludes> 
          <exclude>META-INF/*.SF</exclude> 
          <exclude>META-INF/*.DSA</exclude> 
          <exclude>META-INF/*.RSA</exclude> 
          <exclude>META-INF/*.RSA</exclude> 
         </excludes> 
        </filter> 
       </filters> 
      </configuration> 
     </plugin> 

Próbowałem dodać kolejny filtr, aby usunąć wszystkie zasoby, a następnie dodać kolejny filtr dodając tylko moje zasoby artifactID, ale to nie działa.

    <filter> 
         <artifact>*:*</artifact> 
         <excludes> 
          <exclude>resources/*.*</exclude> 
         </excludes> 
        </filter> <filter> 
         <artifact>my.groupId:my.artifactId</artifact> 
         <includes> 
          <include>resources/*.*</include> 
         </includes> 
        </filter> 

Pomysły?

Dzięki.

+0

wygląda uczciwie, czy Twój filtr nie zawierał zasobów? – Genjuro

Odpowiedz

2

Dzieje się tak, ponieważ filtr obejmuje zdarzenie przed wyłączeniem filtra.

Za pomocą Twojego kodu dodajesz "my.groupId: my.artifactId" -> resources/.

Ale aterwards jesteś wyłączeniem wszystkich "zasobów/."

Z pierwotnego documentation:

Z logicznego punktu widzenia, obejmuje są przetwarzane przed wyklucza, zatem możliwe jest użycie włącz, aby zebrać zestaw plików z archiwum, a następnie użyj wykluczeń, aby dodatkowo zmniejszyć zbiór.