Martin Cooper wrote on Sunday, December 10, 2006 11:06 PM:

> On 12/10/06, Jochen Wiedmann <[EMAIL PROTECTED]> wrote:
>> 
>> On 12/10/06, Martin Cooper <[EMAIL PROTECTED]> wrote:
>> 
>>> Using profiles to provide two different options makes perfect sense
>>> to me. I see no need to proscribe a "one size fits all" solution
>>> that may be non-optimal for many folks when there is a simple means
>>> of providing two alternatives that allows for each person to select
>>> their preferred solution. 
>> 
>> We aren't talking about "joe average profile" here. In particular the
>> "release" profile is *the* profile, which is responsible for
>> deployment settings. 
>> 
>> I have no objection against duplicating the distributionManagement
>> part, so that others may switch to a different deployment scheme.
>> But, as I said, this profile does more than simply selecting the
>> deployment target. It is also responsible for adding the "source"
>> and "javadoc" archives. In the future, it might add additional
>> reports or do more. 
>> 
>> Duplicating the most important part of the POM (and maintaining both
>> source and duplicate in the future) seems to me to be bad practice,
>> at least if you aren't forced to do it. I do not see that we are
>> forced. 
> 
> 
> I didn't say anything about duplicating anything. Why can't
> we split out the
> scp-related part into separate profiles, one for scp and one for
> scpexe? That way, you could choose "mvn -P release,scp" or "mvn -P
> release,scpexe" depending on your preference. That way, all of the
> stuff you're concerned about stays in one place, in the 'release'
> profile. 

We use properties in our company for the distributionManagement section:

        <distributionManagement>
                <repository>
                        <id>company-release</id>
                        <name>Company Maven 2 repository</name>
                        <url>${company.repo.url.base}/repo-m2</url>
                </repository>
                <snapshotRepository>
                        <id>company-snapshot</id>
                        <name>Company Maven 2 snapshot repository</name>
                        <url>${company.repo.url.base}/repo-m2-snapshot</url>
                </snapshotRepository>
                <site>
                        <id>company-site</id>
                        <name>Company Maven project website</name>
                        <url>${elsag.site.url.base}</url>
                </site>
        </distributionManagement>

This makes it very easy to set up profiles. Indeed we use a settings.xml with 
preferences:



1/ Direct file access:

<settings>
    ...
    <servers>
        <server>
            <id>company-release</id>
        </server>
        <server>
            <id>company-snapshot</id>
        </server>
        <server>
            <id>company-site</id>
        </server>
    </servers>
    ....
    <properties>
        
<elsag.repo.url.base>file://///server.company.com/share/to/maven</elsag.repo.url.base>
        
<elsag.site.url.base>file://///server.company.com/share/to/maven/docs</elsag.site.url.base>
    <properties>
</settings>



2/ With PuTTY:

<settings>
    ...
    <servers>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <sshExecutable>plink</sshExecutable>
                <scpExecutable>pscp</scpExecutable>
            </configuration>
            <id>company-release</id>
        </server>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <sshExecutable>plink</sshExecutable>
                <scpExecutable>pscp</scpExecutable>
            </configuration>
            <id>company-snapshot</id>
        </server>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <sshExecutable>plink</sshExecutable>
                <scpExecutable>pscp</scpExecutable>
            </configuration>
            <id>company-site</id>
        </server>
    </servers>
    ....
    <properties>
        
<elsag.repo.url.base>scpexe://server.company.com/path/to/maven</elsag.repo.url.base>
        
<elsag.site.url.base>scpexe://server.company.com/path/to/maven/docs</elsag.site.url.base>
    <properties>
</settings>



3/ With Cygwin (*):

<settings>
    ...
    <servers>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <scpExecutable>scpwin.bat</scpExecutable>
            </configuration>
            <id>company-release</id>
        </server>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <scpExecutable>scpwin.bat</scpExecutable>
            </configuration>
            <id>company-snapshot</id>
        </server>
        <server>
            <filePermissions>664</filePermissions>
            <directoryPermissions>775</directoryPermissions>
            <configuration>
                <scpExecutable>scpwin.bat</scpExecutable>
            </configuration>
            <id>company-site</id>
        </server>
    </servers>
    ...
    <properties>
        
<elsag.repo.url.base>scpexe://server.company.com/path/to/maven</elsag.repo.url.base>
        
<elsag.site.url.base>scpexe://server.company.com/path/to/maven/docs</elsag.site.url.base>
    <properties>
</settings>

(*) scpwin.bat simply contains the line "scp %*" because we found that Cygwin's 
scp always returned a value of 1 instead of 0 and the build failed. Might have 
changed meanwhile.



You can imagine, that a lot more combinations can be supported (like plain scp 
or webdav). It is now simply the question where to put this settings. You may 
add something like this to the parent pom with profiles or expect the devs to 
define something like it into their settings.xml just as we do in our company.

One last word of warning: Do not use the same repository ids for the repos 
defined in the distributionManagement section and the repos defined in the 
repositories or pluginRepositories sections. The latter ones use always the 
http protocol and M2 does not distinguish different types of repositories 
regarding the configuration and will get confused by the parameters necessary 
for the different wagon providers.

- Jörg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to