maven condition based on os family

前端 未结 2 1867
我在风中等你
我在风中等你 2021-01-13 02:54

I am trying to do the following:

                
                    copy-jre

        
相关标签:
2条回答
  • 2021-01-13 03:07

    You can use profiles to do this.

    e.g.

    <profile>
        <id>platform-windows</id>
        <activation>
            <os>
                <family>windows</family>
            </os>
        </activation>
        <build>
            <plugins>
                ...
            </plugins>
        </build>
    </profile>
    

    In your case, you might just want to specify os/family in the profile's activation element.

    0 讨论(0)
  • 2021-01-13 03:17

    The Sonatype book, "Maven: The Complete Reference" section 9.2 deals with maven properties and lists the following properties that are pertinent to your question:

    java.version
    os.name
    

    The java.version property seems usable and in my testing returned "1.6.0_27". However, the os.name property is not exactly an "os family" as you requested. In my case os.name returns "Windows Vista", which I imagine is not what you are hoping for. I don't know of a property to get the os family as you desire it so I recommend using maven profiles as prunge mentioned to handle configuring your plugins with the desired os.

    0 讨论(0)
提交回复
热议问题