1

ここに私の問題があります。ファイルがあります。異なるプロファイルを使用する場合は、それぞれのファイルの名前を変更する必要があります。

だから私はあなたが見つけることができるdev.propertiesに2つの.propertiesファイル、dev.propertiesとrec.propertiesを持っています:

machineName=marin
prefix=DEV
fileOneName=node

rec.properties で見つけることができます:

machineName=marin
prefix=REC
fileOneName=node

私が今欲しいのは、使用するプロファイルを設定するときに、これらの変数の内容を使用できるようにすることです:

    <profile>
        <id>dev</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <!-- Filter name -->
            <cogepat.filter.properties>dev.properties</cogepat.filter.properties>
        </properties>
    </profile>

しかし、次を使用すると、変数が入力されません。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>run-ant-rename-war</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                 <copy file="mavencopyfrom/adeplacer.txt" tofile="mavencopyto/${prefix}_${fileOneName}${machineName}.txt"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
        </plugin>
    </plugins>
</build>

最終的には、次の名前のファイルになります。

${prefix}_${fileOneName}${machineName}.txt
4

1 に答える 1

0

代わりに、次のようにプロパティを設定してみてください。

<profile>
    <id>dev</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <properties>
        <machineName>marin</machineName>
        <prefix>DEV</prefix>
        <fileOneName>node</fileOneName>
    </properties>
</profile>

それでうまくいくはずです。

于 2012-08-21T20:39:59.917 に答える