private File downloadSdk ( final String path ) throws MojoExecutionException { File dotCeylon = new File ( path ) ; // or some other directory if ( ! dotCeylon . exists ( ) ) { dotCeylon . mkdirs ( ) ; } String [ ] segments = this . fromURL . split ( "/" ) ; String file = segments [ segments . length - 1 ] ; String repoUrl = this . fromURL . substring ( 0 , this . fromURL . length ( ) - file . length ( ) ) ; String version = FileUtils . basename ( file ) ; File home = new File ( dotCeylon , version ) ; if ( home . exists ( ) ) { getLog ( ) . info ( "Skipping download: Folder " + version + " corresponding to SDK already exists " + " in " + dotCeylon . getAbsolutePath ( ) ) ; return new File ( home , "repo" ) ; } File outputFile = new File ( dotCeylon , file ) ; if ( outputFile . exists ( ) ) { throw new MojoExecutionException ( "Downloaded file " + outputFile . getAbsolutePath ( ) + " exists. Please remove it and try again" ) ; } try { doGet ( outputFile , repoUrl ) ; } catch ( Exception e ) { throw new MojoExecutionException ( "Error downloading SDK" + e . getLocalizedMessage ( ) , e ) ; } CeylonUtil . extract ( outputFile , dotCeylon ) ; outputFile . delete ( ) ; return new File ( home , "repo" ) ; }
Download the Ceylon SDK .