Maven-dependency-plugin (unpack-dependencies) игнорирует конфигурацию

Произошла следующая проблема: В проекте есть зависимость. Зависимость содержит файлы .js и .css (по сути, они будут использоваться как ресурсы). Мне нужно извлечь и поместить эти файлы в определенное место. Я думал использовать для этого maven-dependency-plugin, но он не использует указанную мной конфигурацию (используйте значения по умолчанию). Подскажите пожалуйста, где я мог ошибаться.

pom.xml:

<dependencies>
    <dependency>
        <groupId>my.group.Id</groupId>
        <artifactId>my-artifact-id</artifactId>
        <version>my_version</version>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <includeScope>runtime</includeScope>
                            <includeGroupIds>my.group.Id</includeGroupIds>
                            <includeArtifactIds>my-artifact-id</includeArtifactIds>
                            <includes>**/*.js,**/*.css</includes>
                            <outputDirectory>${project.basedir}/my/path</outputDirectory>
                            <overwriteReleases>true</overwriteReleases>
                            <overwriteSnapshots>true</overwriteSnapshots>
                            <overwriteIfNewer>true</overwrteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

А может есть способ с maven-antrun-plugin?

titaniche 30.11.2018 14:00
Не удалось выполнить цель org.apache.maven.plugins
Не удалось выполнить цель org.apache.maven.plugins
Опишу, что когда я только начинал изучать Maven, у меня не получалось компилировать и упаковывать.
Blibli Automation Journey - Как захватить сетевой трафик с помощью утилиты HAR в Selenium 4
Blibli Automation Journey - Как захватить сетевой трафик с помощью утилиты HAR в Selenium 4
Если вы являетесь веб-разработчиком или тестировщиком, вы можете быть знакомы с Selenium, популярным инструментом для автоматизации работы...
2
1
1 401
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Вы объявляете выполнение своего плагина в разделе <pluginManagement>. Этот раздел отлично подходит для размещения конфигурация в одном месте и повторного использования его позже, но он не выполнять ваш плагин.

Попробуй это:

  <build>
      <pluginManagement>
          <plugins>
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId> <!-- your example contained a typo. -->
                  <artifactId>maven-dependency-plugin</artifactId>
                  <version>2.10</version>
                  <executions>
                      <execution>
                          <id>unpack</id>
                          <phase>generate-resources</phase>
                          <goals>
                              <goal>unpack-dependencies</goal>
                          </goals>
                          <configuration>
                              <includeScope>runtime</includeScope>
                              <includeGroupIds>commons-lang</includeGroupIds>
                              <includeArtifactIds>commons-lang</includeArtifactIds>
                              <includes>**/*.js,**/*.css</includes>
                              <outputDirectory>${project.basedir}/my/path</outputDirectory>
                              <overwriteReleases>true</overwriteReleases>
                              <overwriteSnapshots>true</overwriteSnapshots>
                              <overwriteIfNewer>true</overwriteIfNewer> <!-- Typo in your POM here as well -->
                          </configuration>
                      </execution>
                  </executions>
              </plugin>
          </plugins>
      </pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
        </plugin>
      </plugins>
   </build>

Другие вопросы по теме