Maven Replacer插件StringUtil问题

时间:2012-12-21 08:18:07

标签: maven

我正在尝试在我的构建中实现Maven Replacer Plugin

但是我坚持这个问题:

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.code.maven-replacer-plugin:replacer:1.5.2:replace (default) on project ReportBCSIS: Execution default of goal com.google.code.maven-replacer-plugin:replacer:1.5.2:replace failed: A required class was missing while executing com.google.code.maven-replacer-plugin:replacer:1.5.2:replace: org/apache/commons/lang/StringUtils
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>com.google.code.maven-replacer-plugin:replacer:1.5.2
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/grudy/.m2/repository/com/google/code/maven-replacer-plugin/replacer/1.5.2/replacer-1.5.2.jar
[ERROR] urls[1] = file:/C:/Users/grudy/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.apache.commons.lang.StringUtils
[ERROR] -> [Help 1]

以下是我目前的pom配置:

    <plugin>
       <groupId>com.google.code.maven-replacer-plugin</groupId>
       <artifactId>replacer</artifactId>
       <version>1.5.2</version>
       <executions>
           <execution>
               <phase>prepare-package</phase>
               <goals>
                   <goal>replace</goal>
               </goals>                   
           </execution>
       </executions>
       <configuration>
           <file>target/${project.artifactId}/index.jsp</file>
           <replacements>
               <replacement>
                   <token>BUILDID-TOKEN</token>
                   <value>121212-HAHA</value>
               </replacement>         
           </replacements>
        </configuration>
    </plugin>

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

在插件内添加文字可以解决问题:

<dependencies>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.6</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.0.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
</dependencies>