通过命令行调用/运行/执行maven插件

时间:2016-03-17 12:08:24

标签: java xml eclipse maven

我正在使用一个使用A,B插件的maven项目。我已经下载了一个插件作为jar file

当我尝试执行以下命令时 mvn tscm:xmlFormatter我收到一个错误,该插件在本地/存储库中不可用。一旦我在settings.xml中添加了pluginrepositories,一切正常。有没有办法通过命令行运行插件,通过指定插件jar文件,以便它可以直接引用。即,无需更改我的设置文件,有任何方法可以通过命令行执行插件。

的pom.xml

<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>
    <groupId>FormatterProject</groupId>
    <artifactId>FormatterProject</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-java-formatter-plugin</groupId>
                <artifactId>maven-java-formatter-plugin</artifactId>
                <version>0.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>format</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <lineEnding>CRLF</lineEnding>
                    <encoding>UTF-8</encoding>
                    <directories>
                        <directory>${project.build.sourceDirectory}</directory>
                    </directories>
                    <configFile>${project.build.sourceDirectory}\com\java\formatter\Ericsson-BSS-Formatter.xml</configFile>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.technicalsoftwareconfigurationmanagement.maven-plugin</groupId>
                <artifactId>tscm-maven-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <useTabs>false</useTabs>
                    <includes>
                        <include>${project.build.sourceDirectory}/**/*.xml</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <phase>verify</phase>
                        <goals>
                            <goal>xmlFormatter</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

不知何故java formatter插件包含在我的项目存储库中,但我想通过命令行执行xml formatter插件而不改变我的环境。

0 个答案:

没有答案