2011-02-27 2 views
1

Maven's website에서 :os가 주어진 패밀리 (예 : mac)가 아닌 경우 pom.xml을 활성화하는 방법은 무엇입니까?

... 
    <profiles> 
    <profile> 
     <id>default-tools.jar</id> 
     <activation> 
     <property> 
      <name>java.vendor</name> 
      <value>Sun Microsystems Inc.</value> 
     </property> 
     </activation> 
     <dependencies> 
     <dependency> 
      <groupId>com.sun</groupId> 
      <artifactId>tools</artifactId> 
      <version>1.4.2</version> 
      <scope>system</scope> 
      <systemPath>${java.home}/../lib/tools.jar</systemPath> 
     </dependency> 
     </dependencies> 
    </profile> 
    </profiles> 
    ... 

tools.jar가 이미 맥에 inclduded classes.jar이 내장되어 있습니다. !

ERROR>warning: [path] bad path element ""/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/lib/tools.jar"": no such file or directory 

답변

0

나는 다른 방법을 찾을 : 대신 항상 얻는, pom.xml 파일에 (맥 제외한 모든 운영 체제를 나열 제외) 활성화 설정에서 맥을 지정할 수있는 방법이 없었다. "activeByDefault"프로파일에 종속성을 가져야합니다. OS가 Mac 인 경우 다른 프로필 (프로필 -2)을 활성화하십시오. this에 따르면 "activeByDefault"프로필은 다른 프로필이 활성화되면 비활성화됩니다. 따라서 OS가 mac 인 경우 profile-2가 활성화되어 "activeByDefault"프로필이 비활성화됩니다.

+0

그럴 수 없습니다. 속성은 없습니다. – simpatico

+0

나는 대답을 편집했다. 이것이 작동하는지 확인하십시오. –

+0

코드로 증명하십시오, 누구? – simpatico

1

'!' (Maven 3.0.3에서 시험해보고 작동한다). here으로 설명한 Enforcer 플러그인과 동일한 알고리즘을 사용합니다.

<profiles> 
    <profile> 
     <id>not-mac</id> 
     <activation> 
      <os> 
       <family>!mac</family> 
      </os> 
     </activation> 
     <properties> 
      <!-- Define non-mac properties here --> 
     </properties> 
    </profile> 
</profiles> 

는 메이븐에 tools.jar를를 사용하는 자세한 설명을 위해 this article를 참조하십시오.

관련 문제