过滤的资产文件 - 机器人 [英] Filtering an assets file - android

查看:130
本文介绍了过滤的资产文件 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想筛选的属性在我的项目的资产目录中的文件。这是所以我不必须保持开发之间的变化值,SIT和我的应用程序的督促版本。我使用maven&安培; IntelliJ IDEA的与(最终)不同的配置文件,但目前我只是试图让构建过程拿起过滤资产目录(如果它是在所有可能的)

I'm trying to filter a properties file in the asset directory of my project. This is so i don't have to keep changing values between dev, SIT and prod versions of my app. I'm using maven & intelliJ IDEA with (eventually) different profiles, but for the moment i'm just trying to get the build process to pick up the filtered assets directory (if it is at all possible)

我已经添加了这些资源行到我的POM:

i've added these resource lines to my POM:

<resource>
    <filtering>true</filtering>
    <directory>assets</directory>
    <includes>
        <include>**/*.properties</include>
    </includes>
    <targetPath>
        ../assets
    </targetPath>
</resource>

<resource>
    <filtering>false</filtering>
    <directory>assets</directory>
    <excludes>
       <exclude>**/*.properties</exclude>
    </excludes>
    <targetPath>
       ../assets
    </targetPath>
</resource>

有没有办法我可以构建过程看过滤资产目录?

Is there a way i can get the build process to look at the filtered assets directory?

推荐答案

试试这个:

<build>
  <resources>
    <resource>
      <directory>${project.basedir}/assets</directory>
      <filtering>true</filtering>
      <targetPath>${project.build.directory}/filtered-assets</targetPath>
      <includes>
        <include>**/*.properties</include>
      </includes>
    </resource>
  </resources>
  <plugins>
    <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <executions>
        <execution>
          <phase>initialize</phase>
          <goals>
            <goal>resources</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>com.jayway.maven.plugins.android.generation2</groupId>
      <artifactId>maven-android-plugin</artifactId>
      <extensions>true</extensions>
      <configuration>
        <sdk>
          <platform>7</platform>
        </sdk>
        <undeployBeforeDeploy>true</undeployBeforeDeploy>
        <resourceDirectory>${project.build.directory}/filtered-assets</resourceDirectory>
      </configuration>
    </plugin>
  </plugins>
</build>

退房MorseFlash Sample项目这里

这篇关于过滤的资产文件 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆