3

私はMavenのアーキタイプを構築しています。ファイル名の置換は正常に機能しています。たとえば、生成されたときに適切に置き換えられる__artifactd __-log4j.xml という名前のファイルがあります。しかし、それを参照するxmlファイルの1つであるSpringコンテキストファイルは、置き換えられていません。

<?xml version="1.0" encoding="UTF-8"?>

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">



<context:annotation-config />


<bean id="log4jConfigurer" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
    <property name="targetClass" value="org.springframework.util.Log4jConfigurer"></property>
    <property name="targetMethod" value="initLogging"></property>
     <property name="arguments">
     <list>
        <value>classpath:${artifactId}-log4j.xml</value>
        <value>5000</value>
     </list>
  </property>
</bean>

何らかの理由で、xml ファイル内のトークン ${artifactId} が置き換えられることはありません。私のarchetype-metadata.xml

 <modules>
<module id="${rootArtifactId}-services" dir="__rootArtifactId__-services" name="${rootArtifactId}-services">
  <fileSets>
    <fileSet filtered="true" packaged="true" encoding="UTF-8">
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" encoding="UTF-8">
      <directory>src/main/webapp</directory>
      <includes>
        <include>**/*.jsp</include>
        <include>**/*.xml</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" encoding="UTF-8">
      <directory>src/main/resources</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </fileSet>
  </fileSets>
</module>

spring-file は src/main/resources の下にあり、fileSet がfiltered に設定されているため、velocity に置き換えられているはずですよね?

何か案は?

4

2 に答える 2

0

使ってみました${project.artifactId}か?Maven Reference Bookによると、すべてのプロジェクト プロパティにはprojectプレフィックスがあります。

于 2012-08-16T20:34:41.013 に答える
0

まあ、私は使用したテンプレート プロジェクトを mvn archetype:create-from-project の代わりに generated-resources から変更していました。これが理由です。

それで、VLT doubled をエスケープして終了しました。

固定 :D

于 2012-08-16T21:28:38.450 に答える