亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用Maven執行程序?

如何使用Maven執行程序?

慕后森 2019-12-13 09:28:00
我想讓Maven目標觸發Java類的執行。我正在嘗試通過以下方式進行遷移Makefile:neotest:    mvn exec:java -Dexec.mainClass="org.dhappy.test.NeoTraverse"我想mvn neotest提出make neotest目前的工作。無論是Exec插件的文件,也不是Maven的Ant任務的網頁有任何形式的簡單例子。目前,我在:<plugin>  <groupId>org.codehaus.mojo</groupId>  <artifactId>exec-maven-plugin</artifactId>  <version>1.1</version>  <executions><execution>    <goals><goal>java</goal></goals>  </execution></executions>  <configuration>    <mainClass>org.dhappy.test.NeoTraverse</mainClass>  </configuration></plugin>不過,我不知道如何從命令行觸發插件。
查看完整描述

2 回答

?
慕田峪9158850

TA貢獻1794條經驗 獲得超7個贊

為了執行多個程序,我還需要一個profiles部分:


<profiles>

  <profile>

    <id>traverse</id>

    <activation>

      <property>

        <name>traverse</name>

      </property>

    </activation>

    <build>

      <plugins>

        <plugin>

          <groupId>org.codehaus.mojo</groupId>

          <artifactId>exec-maven-plugin</artifactId>

          <configuration>

            <executable>java</executable>

            <arguments>

              <argument>-classpath</argument>

              <argument>org.dhappy.test.NeoTraverse</argument>

            </arguments>

          </configuration>

        </plugin>

      </plugins>

    </build>

  </profile>

</profiles>

然后可以執行以下命令:


mvn exec:exec -Dtraverse


查看完整回答
反對 回復 2019-12-13
  • 2 回答
  • 0 關注
  • 591 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號