2013-06-03 2 views
0

maven에서 adb.exe 명령을 실행할 수 있습니까? 예를 들어 adb 쉘 악기 -e classname # testcasename -w 패키지 이름/instrumenation을 실행하고 싶습니다. 나는 maven에서이 명령을 실행할 필요가 있습니까 ?? pom.xml 파일에서 지정해야하거나 명령 줄 인수를 지정하여 직접 실행할 수 있습니까?maven 3.0.5에서 adb.exe 명령 실행

답변

1

Maven Exec Plugin을 사용하여 cmd 명령을 실행할 수 있습니다.

귀하의 경우에는
<project> 
... 
<build> 
    <plugins> 
     <plugin> 
      <artifactId>exec-maven-plugin</artifactId> 
      <groupId>org.codehaus.mojo</groupId> 
      <version>1.2.1</version> 
      <executions> 
       <execution> 
        <id>My Command Runner</id> 
        <phase>install</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <configuration> 
         <executable>ping</executable> 
         <arguments> 
          <argument>8.8.8.8</argument> 
         </arguments> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 
... 
</project> 


, 내부 configuration 것 : 아래의 조각 (A pom.xml에 추가)에서

, 때마다 실행됩니다 8.8.8.8 인수로 명령 ping 당신은 mvn install 할 주위에 있으십시오 :

<configuration> 
    <executable>adb </executable> 
    <arguments> 
     <argument>shell</argument> 
     <argument>instrument</argument> 
     <argument>-e</argument> 
     <argument>classname#testcasename</argument> 
     <argument>-w</argument> 
     <argument>packagename/instrumenation</argument> 
    </arguments> 
</configuration> 

정말 필요한 단계에 바인딩해야합니다. 위의 예는 설명한대로 mvn install에 바인딩되어 있습니다. 즉 누군가가 (install) 단계를 실행할 때 명령이 실행됨을 의미합니다.

+0

Windows OS 및 에뮬레이터에서이 작업을 수행하고 있습니다. 거기에/시스템/bin/쉬고있어 : 악기 : 오류를 찾을 수 없습니다. –

+0

죄송합니다. 나는 잘못된 주장을했습니다. Thxs acdcjunior. –