Плагин сборки Maven, не исключающий ресурсы из архива

У меня есть некоторые свойства и файлы XML в моем каталоге src/main/resources моего проекта maven. Я хотел бы исключить эти файлы

При сборке двоичного файла ни один из этих файлов не исключается, хотя я настроил их таким образом. Я не знаю, что я делаю неправильно.

Моя настройка pom.xml

 <plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.4.1</version>
    <configuration>
      <descriptors>
        <descriptor>src/main/resources/assembly-plugin/assembly.xml</descriptor>
      </descriptors>
    </configuration>
    <executions>
      <execution>
        <id>make-assembly</id> <!-- this is used for inheritance merges -->
        <phase>package</phase> <!-- bind to the packaging phase -->
        <goals>
          <goal>single</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

Настройка assembly.xml

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <id>distribution</id>
  <formats>
    <format>jar</format>
  </formats>
   <fileSets>
    <fileSet>
      <directory>${basedir}/src/main/resources/common-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
    <fileSet>
      <directory>${basedir}/src/main/resources/dotcom-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
    <fileSet>
      <directory>${basedir}/src/main/resources/olb-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>

Я выполняю команду mvn package assembly:single, чтобы сделать то же самое.

Журналы ошибок

[INFO] Skipping project-jar
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.074s
[INFO] Finished at: Sat Aug 23 13:30:25 PDT 2014
[INFO] Final Memory: 29M/45M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on project project-jar: Failed to create assembly: Error creating assembly archive distribution: You must set at least one file. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

person Kartik    schedule 23.08.2014    source источник
comment
Можете ли вы точно описать, какие файлы/папки должны быть упакованы с помощью плагина maven-assembly-plugin, а какие нет?   -  person khmarbaise    schedule 23.08.2014
comment
Я хочу исключить все файлы в src/main/resources/olb-conf/, src/main/resources/common-conf и src/main/resources/common-conf   -  person Kartik    schedule 24.08.2014
comment
Если вы хотите исключить все эти файлы, почему бы вам не поместить их в другую папку, например src/main/olb-conf?   -  person khmarbaise    schedule 25.08.2014
comment
@khmarbaise Устаревшему коду около 5 лет. Я не могу изменить структуру пакета, так как он многое ломает. Я пытался.   -  person Kartik    schedule 25.08.2014


Ответы (1)


не могли бы вы объяснить, что такое ваш ${basedir}? Это свойство фильтровать по процессу ресурсов maven? тогда вы должны знать: бесполезно исключать файлы unser src, это не относится к сгенерированному артефакту, вы должны заменить их на target/classes/your-package.

вот ссылка, это может не сработать, но вы можете узнать, как настроить

    <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <id>distribution</id>
  <formats>
    <format>jar</format>
  </formats>
   <fileSets>
    <fileSet>
      <directory>target/classes/common-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
    <fileSet>
      <directory>target/classes/dotcom-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
    <fileSet>
      <directory>target/classes/olb-conf</directory>
      <outputDirectory></outputDirectory>
      <excludes>
        <exclude>*.*</exclude>
      </excludes>
    </fileSet>
  </fileSets>
</assembly>
person Laurence Geng    schedule 23.08.2014