2013-06-27 56 views
0

我正在使用名爲Windchill的工具。我已經準備好通過xml文件加載一些屬性。要加載這些xml文件,我使用以下命令。如何在MAVEN中使用pom.xml運行LoadFromFile命令?

對於如:西北偏西wt.load.LoadFromFile -d C:\ PTC \ Windchill_10.1 \的Windchill \ loadFiles \ PDMLink的\ ITC \屬性\ Attributes.xml -u wcadmin -p wcadmin

喜歡我有大約100個命令可以在windchill命令提示符下手動運行。所以我基本上希望通過使用MAVEN順序執行這些命令來自動執行這個過程,而無需任何手動工作。

有沒有什麼辦法可以部署這個版本。請幫忙。

謝謝。

回答

2

我建議看看exec-maven-plugin這似乎是你想要達到的目標的正確選擇。

<project> 
    ... 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.2.1</version> 
     <executions> 
      <execution> 
      ... 
      <phase>WhatEver</phase> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <executable>windchill </executable> 
      <!-- optional --> 
      <workingDirectory>/tmp</workingDirectory> 
      <arguments> 
      <argument>wt.load.LoadFromFile</argument> 
      <argument>and so on</argument> 
      ... 
      </arguments> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    ... 
</project> 
+0

謝謝!我會研究它 – galme

+0

我準備了上述格式的pom.xml,並且我正在執行命令提示符下面的命令:mvn exec:exec -Dexec.executable =「windchill」[-Dexec.workingdir =「C:\ mvn \ test「] -Dexec.args =」wt.load.LoadFromFile -d「C:/ptc/Windchill_10.1/Windchill/loadFiles/pdmlink/itc/attributes/Attributes.xml」。 – galme

+0

但是我收到錯誤爲: [錯誤]在當前項目 和插件組[org.apache.maven.plugins,org.codehaus.mojo]可用 e中找不到前綴'[-Dexec.workingdir = C'存儲庫[本地(C:\ Users \ Administrator \ .m2 \ repository),中央 (http://repo.maven.apache.org/maven2)] – galme

0

<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>Build</groupId> 
    <artifactId>Build_SMB</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0</version> 
    <name>SMB PROJECT</name> 
    <build> 
    <plugins> 
     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.2.1</version> 
     <executions> 
      <execution> 
      <phase>deploy</phase> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <executable>windchill</executable> 
      <!-- optional --> 
      <workingDirectory>C:/mvn/test</workingDirectory> 
      <arguments> 
      <argument>wt.load.LoadFromFile</argument> 
      <argument>-d</argument> 
      <argument>C:/ptc/Windchill_10.1/Windchill/loadFiles/pdmlink/itc/attributes/Attributes.xml</argument> 
      <argument>-u</argument> 
      <argument>wcadmin</argument> 
      <argument>-p</argument> 
      <argument>wcadmin</argument> 
      </arguments> 
      <systemProperties> 
      <systemProperty> 
       <key>WT_HOME</key> 
       <value>${env.WT_HOME}</value> 
      </systemProperty> 
      </systemProperties> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
</project> 
+0

以上是pom .xml我創建 – galme

相關問題