Home | History | Annotate | Download | only in tycho
      1 This folder mirrors a small subset of artifacts from Maven Central [1].
      2 
      3 In order to create this mirror, we do the following steps:
      4  
      5  1. Create a settings.xml [2] file that specifies the location for the
      6     repository.
      7  2. Run maven to build the IDE. This process will use Tycho and download
      8     and cache all the dependencies in the specified repository.
      9  3. Remove the folder p2 inside the repository, which contains artifacts
     10     generated during the build in step 2. We only need cached artifacts.
     11  4. Update settings.xml to specify that it should run in offline mode,
     12     and make sure that the repository has all the necessary contents.
     13 
     14 Step 1: Create a settings.xml
     15 
     16 <?xml version="1.0" encoding="UTF-8"?>
     17 <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
     18           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     19           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
     20           http://maven.apache.org/xsd/settings-1.0.0.xsd">
     21   <localRepository>/path/to/tycho/tycho-dependencies-m2repo</localRepository>
     22   <offline>false</offline>
     23 </settings>
     24 
     25 Step 2: Run maven using the above settings.xml
     26 
     27  $ cd /path/to/folder/with/pom.xml
     28  $ mvn -s /path/to/above/settings.xml package
     29 
     30 This should download and cache all the necessary dependencies in the repository
     31 specified in the settings.xml.
     32 
     33 Step 3: Remove unnecessary files from the repository. It turns out that Tycho
     34 also populates a whole bunch of eclipse plugins into the p2 folder inside the
     35 repository. These don't need to be checked in, so they can be removed.
     36 
     37 Step 4: Validate that the repository contains everything necessary by changing
     38 the offline attribute to true, and then rebuild.
     39 
     40 If everything goes well, then the repository can be checked in.
     41 
     42 TODO
     43 
     44 This method could possibly be automated using the Maven Dependency plugin [3].
     45 The "copy-dependencies" task from that plugin allows you to recursively copy
     46 all the dependencies of a particular POM. Here is an example command to download
     47 all the dependencies for com.android.tools:sdklib:22.7.2
     48 
     49  $ mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:copy-dependencies \
     50     -f ~/.m2/repository/com/android/tools/sdklib/22.7.2/sdklib-22.7.2.pom \
     51     -DoutputDirectory=`pwd`/target \
     52     -Dmdep.copyPom=true \
     53     -Dmdep.useRepositoryLayout=true
     54 
     55 Unfortunately, this doesn't seem to work for the Tycho plugin since it seems
     56 like a more complicated multi module setup. The POM for the Tycho plugin specifies
     57 sub modules which the dependency plugin doesn't seem to be able to cope with.
     58 
     59 [1] http://search.maven.org/
     60 [2] https://maven.apache.org/settings.html
     61 [3] http://maven.apache.org/plugins/maven-dependency-plugin/
     62