How can I deploy artifacts from a Maven build to the SourceForge File Release System?

后端 未结 9 1347
耶瑟儿~
耶瑟儿~ 2020-12-31 11:28

I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and

9条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-31 11:28

    This really did not turn out to be that hard. First up I had the mvn site:deploy working following the instructions at this sourceforge site. Basically you start the sourceforge shell with

    ssh -t user,project@shell.sourceforge.net create
    

    That will create the shell at their end with a folder mounted to your project on a path such as (depending on your projects name):

    /home/groups/c/ch/chex4j/
    

    In that shell I on the sourceforge server I created a folder for my repo under the project apache folder "htdocs" with

    mkdir /home/groups/c/ch/chex4j/htdocs/maven2
    

    In my settings.xml I set the username and password to that shell server so that maven can login:

     
      
            
                chex4j.sf.net
                me,myproject
                password
                775
                775
            
        
    
    

    In the pom.xml you just need your distibutionManagement section setup to name the server by ID that you set the password for in your settings file:

    
        
            chex4j.sf.net
            scp://shell.sourceforge.net/home/groups/c/ch/chex4j/htdocs/
            
        
        
            chex4j.sf.net
            SourceForge shell repo
            scp://shell.sourceforge.net/home/groups/c/ch/chex4j/htdocs/maven2
        
    
    

    There the repository entry is the one for the mvn deploy command and the site entry is for the mvn site:deploy command. Then all I have to do is start the shell connection to bring up the server side then on my local side just run:

    mvn deploy
    

    which uploads the jar, pom and sources and the like onto my sourceforge projects website. If you try to hit the /maven2 folder on your project website sourceforge kindly tell you that directory listing is off by default and how to fix it. To do this on the server shell you create a .htaccess file in your htdocs/maven2 folder containing the following apache options

    Options +Indexes
    

    Then bingo, you have a maven repo which looks like:

    http://chex4j.sourceforge.net/maven2/net/sf/chex4j/chex4j-core/1.0.0/

    Your sf.net shell it shuts down after a number of hours to not hog resources; so you run the "ssh -t ... create" when you want to deploy the site or your build artifacts.

    You can browse all my maven project code under sourceforge to see my working settings:

    http://chex4j.svn.sourceforge.net/viewvc/chex4j/branches/1.0.x/chex4j-core/

提交回复
热议问题