使用特定配置文件构建依赖关系

时间:2015-10-08 21:49:25

标签: web maven-3 netbeans-platform

我有一个带有依赖项的Web项目我希望在不同的配置文件上编译,因此它会在Web项目中生成一些我想要的其他文件。

更具体地说,是一个将Netbeans Application作为依赖项的Web项目。 Netbeans项目有一个部署配置文件,用于创建更新中心(只是包含文件的文件夹)。我希望将此更新中心添加到war文件中以进行部署。

有没有办法让Web项目构建对此配置文件的依赖,以便获取我需要的文件?

还有其他选择让这项工作吗?

更新:示例

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <!-- The Basics -->
  <groupId>...</groupId>
  <artifactId>...</artifactId>
  <version>...</version>
  <dependencies>
    <dependency>
      <groupId>project-of-interest</groupId>
      <artifactId>project-id</artifactId>
      <version>4.0</version>
      <type>jar</type>
    </dependency>
  </dependencies>
<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <webResources>
        <resource>
          <!-- this is relative to the pom.xml directory -->
          <directory>resource2</directory>
        </resource>
      </webResources>
    </configuration>
  </plugin>
</plugins>
</build>
</project>

感兴趣的项目有一个部署配置文件,其中生成了我需要的文件,并且some2指向这些文件的位置。

我的主要问题是确保我需要的文件可用。

1 个答案:

答案 0 :(得分:1)

您可以使用maven命令指向特定的配置文件

mvn clean install -P $profile
相关问题