summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorEckart Langhuth2011-08-18 08:28:40 (EDT)
committer jsievers2011-09-23 05:20:48 (EDT)
commit25a11ba5099d30c1eb0d62fbd13284ba046ef329 (patch)
treeee8d2b2456ff7fa7ca3939c0109cf02c179238da
parent18b7b82d16ec7024ee9afb40e63b8e9d5deb496f (diff)
downloadorg.eclipse.tycho-25a11ba5099d30c1eb0d62fbd13284ba046ef329.zip
org.eclipse.tycho-25a11ba5099d30c1eb0d62fbd13284ba046ef329.tar.gz
org.eclipse.tycho-25a11ba5099d30c1eb0d62fbd13284ba046ef329.tar.bz2
351080 Avoid stack trace dumps for outdated repository index files
In case the index references content which was deleted from the local repository manually, these references will be removed gracefully instead of dumping an exception stack. Renamed LocalTychoRepositoryIndex to FileBasedTychoRepositoryIndex
-rw-r--r--tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/DefaultTychoRepositoryIndex.java65
-rw-r--r--tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/FileBasedTychoRepositoryIndex.java65
-rw-r--r--tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/LocalTychoRepositoryIndex.java72
-rw-r--r--tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/TychoRepositoryIndex.java36
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalArtifactRepositoryTest.java28
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalMetadataRepositoryTest.java52
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenArtifactRepository.java25
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenMetadataRepository.java27
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepository.java10
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepositoryFactory.java4
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalMetadataRepository.java7
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/MemoryTychoRepositoryIndex.java22
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleArtifactRepository.java3
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleMetadataRepository.java3
-rw-r--r--tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java11
-rw-r--r--tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/PomDependencyProcessor.java15
-rw-r--r--tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/UpdateLocalIndexMojo.java4
17 files changed, 283 insertions, 166 deletions
diff --git a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/DefaultTychoRepositoryIndex.java b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/DefaultTychoRepositoryIndex.java
index 9a3a875..2866134 100644
--- a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/DefaultTychoRepositoryIndex.java
+++ b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/DefaultTychoRepositoryIndex.java
@@ -18,64 +18,45 @@ import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Set;
/**
* Default implementation of TychoRepositoryIndex defines tycho repository index format and provides
* generic index read/write methods.
*/
-public class DefaultTychoRepositoryIndex implements TychoRepositoryIndex {
+public abstract class DefaultTychoRepositoryIndex implements TychoRepositoryIndex {
protected static final String ENCODING = "UTF8";
protected static final String EOL = "\n";
- // must match extension point filter in org.eclipse.tycho.p2.maven.repository/plugin.xml
- public static final String INDEX_RELPATH = ".meta/p2-metadata.properties";
+ private Set<GAV> gavs;
- protected Set<GAV> gavs = new LinkedHashSet<GAV>();
-
- protected DefaultTychoRepositoryIndex() {
- }
-
- public DefaultTychoRepositoryIndex(InputStream indexFileContent) throws IOException {
- gavs = read(indexFileContent);
- }
-
- protected static Set<GAV> read(InputStream is) throws IOException {
- LinkedHashSet<GAV> result = new LinkedHashSet<GAV>();
-
- BufferedReader br = new BufferedReader(new InputStreamReader(is, ENCODING));
- try {
- String str;
- while ((str = br.readLine()) != null) {
- result.add(GAV.parse(str));
- }
- } finally {
- br.close();
- }
-
- return result;
+ DefaultTychoRepositoryIndex() {
+ this(Collections.<GAV> emptySet());
}
- public List<GAV> getProjectGAVs() {
- return new ArrayList<GAV>(gavs);
+ public DefaultTychoRepositoryIndex(Set<GAV> intitialContent) {
+ gavs = new LinkedHashSet<GAV>(intitialContent);
}
- public void addProject(String groupId, String artifactId, String version) {
- addProject(new GAV(groupId, artifactId, version));
+ public Set<GAV> getProjectGAVs() {
+ return Collections.unmodifiableSet(new LinkedHashSet<GAV>(gavs));
}
public void addProject(GAV gav) {
gavs.add(gav);
}
- public void write(OutputStream os) throws IOException {
+ public void remove(GAV gav) {
+ gavs.remove(gav);
+ }
+
+ protected static void write(TychoRepositoryIndex index, OutputStream os) throws IOException {
Writer out = new OutputStreamWriter(new BufferedOutputStream(os), ENCODING);
try {
- for (GAV gav : gavs) {
+ for (GAV gav : index.getProjectGAVs()) {
out.write(gav.toExternalForm());
out.write(EOL);
}
@@ -85,4 +66,20 @@ public class DefaultTychoRepositoryIndex implements TychoRepositoryIndex {
}
}
+ protected static Set<GAV> read(InputStream is) throws IOException {
+ LinkedHashSet<GAV> result = new LinkedHashSet<GAV>();
+
+ BufferedReader br = new BufferedReader(new InputStreamReader(is, ENCODING));
+ try {
+ String str;
+ while ((str = br.readLine()) != null) {
+ result.add(GAV.parse(str));
+ }
+ } finally {
+ br.close();
+ }
+
+ return result;
+ }
+
}
diff --git a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/FileBasedTychoRepositoryIndex.java b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/FileBasedTychoRepositoryIndex.java
new file mode 100644
index 0000000..930967b
--- /dev/null
+++ b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/FileBasedTychoRepositoryIndex.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2011 Sonatype Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sonatype Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tycho.p2.repository;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * Simplistic local Maven repository index to allow efficient lookup of all installed Tycho
+ * projects. The content is persisted in a local file.
+ */
+public class FileBasedTychoRepositoryIndex extends DefaultTychoRepositoryIndex {
+ private final File storageFile;
+
+ public static final String ARTIFACTS_INDEX_RELPATH = ".meta/p2-artifacts.properties";
+
+ public static final String METADATA_INDEX_RELPATH = ".meta/p2-local-metadata.properties";
+
+ private FileBasedTychoRepositoryIndex(File indexFile, Set<GAV> content) {
+ super(content);
+ this.storageFile = indexFile;
+ }
+
+ public void save() throws IOException {
+ storageFile.getParentFile().mkdirs();
+ DefaultTychoRepositoryIndex.write(this, new FileOutputStream(storageFile));
+ }
+
+ public static TychoRepositoryIndex createRepositoryIndex(File basedir, String relpath) {
+ File inputFile = new File(basedir, relpath);
+ Set<GAV> content = new LinkedHashSet<GAV>();
+ if (inputFile.exists()) {
+ try {
+ content = DefaultTychoRepositoryIndex.read(new FileInputStream(inputFile));
+ } catch (IOException e) {
+ throw new RuntimeException("Unable to load index file " + inputFile, e);
+ }
+ }
+ return new FileBasedTychoRepositoryIndex(inputFile, content);
+ }
+
+ public static void addProject(File basedir, String groupId, String artifactId, String version) throws IOException {
+ TychoRepositoryIndex artifactsIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(basedir,
+ ARTIFACTS_INDEX_RELPATH);
+ artifactsIndex.addProject(new GAV(groupId, artifactId, version));
+ artifactsIndex.save();
+
+ TychoRepositoryIndex metadataIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(basedir,
+ METADATA_INDEX_RELPATH);
+ metadataIndex.addProject(new GAV(groupId, artifactId, version));
+ metadataIndex.save();
+ }
+}
diff --git a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/LocalTychoRepositoryIndex.java b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/LocalTychoRepositoryIndex.java
deleted file mode 100644
index 1e67f0f..0000000
--- a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/LocalTychoRepositoryIndex.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Sonatype Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sonatype Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tycho.p2.repository;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.LinkedHashSet;
-
-/**
- * Simplistic local Maven repository index to allow efficient lookup of all installed Tycho
- * projects.
- */
-public class LocalTychoRepositoryIndex extends DefaultTychoRepositoryIndex {
- private final File indexFile;
-
- public static final String ARTIFACTS_INDEX_RELPATH = ".meta/p2-artifacts.properties";
-
- public static final String METADATA_INDEX_RELPATH = ".meta/p2-local-metadata.properties";
-
- public LocalTychoRepositoryIndex(File basedir, String relpath) {
- this.indexFile = new File(basedir, relpath);
- try {
- this.gavs = read(new FileInputStream(indexFile));
- } catch (IOException e) {
- // lets assume index does not exist yet
- this.gavs = new LinkedHashSet<GAV>();
- }
- }
-
- public static void addProject(File basedir, String groupId, String artifactId, String version) throws IOException {
- lock(basedir);
-
- try {
- LocalTychoRepositoryIndex artifactsIndex = new LocalTychoRepositoryIndex(basedir, ARTIFACTS_INDEX_RELPATH);
- artifactsIndex.addProject(groupId, artifactId, version);
- artifactsIndex.save();
-
- LocalTychoRepositoryIndex metadataIndex = new LocalTychoRepositoryIndex(basedir, METADATA_INDEX_RELPATH);
- metadataIndex.addProject(groupId, artifactId, version);
- metadataIndex.save();
- } finally {
- unlock(basedir);
- }
- }
-
- public void save() throws IOException {
- indexFile.getParentFile().mkdirs();
-
- write(new FileOutputStream(indexFile));
- }
-
- public static void unlock(File basedir) {
- // TODO Auto-generated method stub
-
- }
-
- public static void lock(File basedir) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/TychoRepositoryIndex.java b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/TychoRepositoryIndex.java
index cfce63a..07c3062 100644
--- a/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/TychoRepositoryIndex.java
+++ b/tycho-p2-resolver/org.eclipse.tycho.p2.resolver.facade/src/main/java/org/eclipse/tycho/p2/repository/TychoRepositoryIndex.java
@@ -10,10 +10,42 @@
*******************************************************************************/
package org.eclipse.tycho.p2.repository;
-import java.util.List;
+import java.io.IOException;
+import java.util.Set;
public interface TychoRepositoryIndex {
- List<GAV> getProjectGAVs();
+ /**
+ * Receive the set of GAVs contained in this index
+ *
+ * @return an unmodifiable defensive copy of the GAV set contained in this index
+ */
+ Set<GAV> getProjectGAVs();
+
+ /**
+ * Adds a GAV to the index
+ *
+ * @see {@link #save()}
+ * @param gav
+ */
+ void addProject(GAV gav);
+
+ /**
+ * Remove a GAV from the index.
+ *
+ * @param gav
+ * @see {@link #save()}
+ */
+ void remove(GAV gav);
+
+ /**
+ * Changes performed via {@link #addProject(GAV)} , {@link #remove(GAV)} will only be reflected
+ * in the memory state of the index. In case the index is bound some persistence location (e.g.
+ * a file see {@link FileBasedTychoRepositoryIndex#createRepositoryIndex(java.io.File, String)})
+ * the method will store the current memory content to the persistence storage.
+ *
+ * @throws IOException
+ */
+ void save() throws IOException;
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalArtifactRepositoryTest.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalArtifactRepositoryTest.java
index 680e549..16419c3 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalArtifactRepositoryTest.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalArtifactRepositoryTest.java
@@ -31,7 +31,9 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
import org.eclipse.tycho.p2.maven.repository.Activator;
import org.eclipse.tycho.p2.maven.repository.LocalArtifactRepository;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
+import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -60,6 +62,29 @@ public class LocalArtifactRepositoryTest {
}
@Test
+ public void testOutdatedIndex() {
+ //create Repo with single artifact
+ LocalArtifactRepository repo = new LocalArtifactRepository(basedir);
+ ArtifactDescriptor desc = newBundleArtifactDescriptor(false);
+ repo.addDescriptor(desc);
+ repo.save();
+
+ // check: the artifact is in the index
+ TychoRepositoryIndex artifactIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(basedir,
+ FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
+ Assert.assertFalse(artifactIndex.getProjectGAVs().isEmpty());
+
+ // delete artifact content from file system
+ deleteDir(new File(basedir, "p2"));
+
+ // create a new repo and check that the reference was gracefully removed from the index
+ repo = new LocalArtifactRepository(basedir);
+ artifactIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(basedir,
+ FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
+ Assert.assertTrue(artifactIndex.getProjectGAVs().isEmpty());
+ }
+
+ @Test
public void getP2Location() {
LocalArtifactRepository repo = new LocalArtifactRepository(basedir);
@@ -100,7 +125,8 @@ public class LocalArtifactRepositoryTest {
ArtifactDescriptor desc = newBundleArtifactDescriptor(true);
Assert.assertEquals(new File(basedir,
- "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.jar"), repo.getArtifactFile(desc));
+ "group/org.eclipse.tycho.test.maven/1.0.0/org.eclipse.tycho.test.maven-1.0.0.jar"), repo
+ .getArtifactFile(desc));
}
@Test
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalMetadataRepositoryTest.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalMetadataRepositoryTest.java
index 9deb27b..e34db50 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalMetadataRepositoryTest.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository.tests/src/test/java/org/eclipse/tycho/p2/maven/repository/tests/LocalMetadataRepositoryTest.java
@@ -29,9 +29,10 @@ import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.tycho.p2.maven.repository.LocalMetadataRepository;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
+import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
import org.junit.Test;
public class LocalMetadataRepositoryTest {
@@ -47,14 +48,14 @@ public class LocalMetadataRepositoryTest {
}
protected IMetadataRepository loadRepository(File location) throws ProvisionException {
- return new LocalMetadataRepository(location.toURI(), new LocalTychoRepositoryIndex(location,
- LocalTychoRepositoryIndex.METADATA_INDEX_RELPATH), new LocalRepositoryReader(location));
+ return new LocalMetadataRepository(location.toURI(), FileBasedTychoRepositoryIndex.createRepositoryIndex(
+ location, FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH), new LocalRepositoryReader(location));
}
protected LocalMetadataRepository createRepository(File location, String groupId, String artifactId, String version)
throws ProvisionException {
location.mkdirs();
- File metadataFile = new File(location, LocalTychoRepositoryIndex.INDEX_RELPATH);
+ File metadataFile = new File(location, FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH);
metadataFile.delete();
metadataFile.getParentFile().mkdirs();
@@ -100,4 +101,47 @@ public class LocalMetadataRepositoryTest {
Assert.assertEquals(1, ius.size());
}
+ @Test
+ public void testOutdatedIndex() throws CoreException {
+ // create and fill repo
+ File location = new File("target/indexmetadataRepo");
+ LocalMetadataRepository repository = createRepository(location, "group", "artifact", "version");
+ InstallableUnitDescription iud = new MetadataFactory.InstallableUnitDescription();
+ iud.setId("test");
+ iud.setVersion(Version.parseVersion("1.0.0"));
+ iud.setProperty(RepositoryLayoutHelper.PROP_GROUP_ID, "group");
+ iud.setProperty(RepositoryLayoutHelper.PROP_ARTIFACT_ID, "artifact");
+ iud.setProperty(RepositoryLayoutHelper.PROP_VERSION, "version");
+ IInstallableUnit iu = MetadataFactory.createInstallableUnit(iud);
+ repository.addInstallableUnits(Arrays.asList(iu));
+ repository = (LocalMetadataRepository) loadRepository(location);
+
+ // check: the artifact is in the index
+ TychoRepositoryIndex metaIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(location,
+ FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH);
+ Assert.assertFalse(metaIndex.getProjectGAVs().isEmpty());
+
+ // delete artifact from file system
+ deleteDir(new File(location, "group"));
+
+ // create a new repo and check that the reference was gracefully removed from the index
+ repository = (LocalMetadataRepository) loadRepository(location);
+ metaIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(location,
+ FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH);
+ Assert.assertTrue(metaIndex.getProjectGAVs().isEmpty());
+
+ }
+
+ private void deleteDir(File dir) {
+ File[] files = dir.listFiles();
+ if (files != null) {
+ for (File file : files) {
+ if (file.isDirectory()) {
+ deleteDir(file);
+ }
+ file.delete();
+ }
+ }
+ }
+
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenArtifactRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenArtifactRepository.java
index a0766bf..0634141 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenArtifactRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenArtifactRepository.java
@@ -84,15 +84,24 @@ public abstract class AbstractMavenArtifactRepository extends AbstractArtifactRe
for (final GAV gav : projectIndex.getProjectGAVs()) {
try {
- final InputStream is = contentLocator.getContents(gav, RepositoryLayoutHelper.CLASSIFIER_P2_ARTIFACTS,
- RepositoryLayoutHelper.EXTENSION_P2_ARTIFACTS);
- try {
- final Set<IArtifactDescriptor> gavDescriptors = io.readXML(is);
- for (IArtifactDescriptor descriptor : gavDescriptors) {
- internalAddDescriptor(descriptor);
+ File localArtifactFileLocation = contentLocator.getLocalArtifactLocation(gav,
+ RepositoryLayoutHelper.CLASSIFIER_P2_ARTIFACTS, RepositoryLayoutHelper.EXTENSION_P2_ARTIFACTS);
+ if (!localArtifactFileLocation.exists()) {
+ // if files have been manually removed from the repository, simply adjust the meta info file (bug 351080)
+ projectIndex.remove(gav);
+ projectIndex.save();
+ } else {
+ final InputStream is = contentLocator.getContents(gav,
+ RepositoryLayoutHelper.CLASSIFIER_P2_ARTIFACTS,
+ RepositoryLayoutHelper.EXTENSION_P2_ARTIFACTS);
+ try {
+ final Set<IArtifactDescriptor> gavDescriptors = io.readXML(is);
+ for (IArtifactDescriptor descriptor : gavDescriptors) {
+ internalAddDescriptor(descriptor);
+ }
+ } finally {
+ is.close();
}
- } finally {
- is.close();
}
} catch (IOException e) {
// TODO throw properly typed exception if repository cannot be loaded
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenMetadataRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenMetadataRepository.java
index 41c477f..d135f45 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenMetadataRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/AbstractMavenMetadataRepository.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.tycho.p2.maven.repository;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -71,15 +72,23 @@ public abstract class AbstractMavenMetadataRepository extends AbstractMetadataRe
for (GAV gav : projectIndex.getProjectGAVs()) {
try {
- InputStream is = contentLocator.getContents(gav, RepositoryLayoutHelper.CLASSIFIER_P2_METADATA,
- RepositoryLayoutHelper.EXTENSION_P2_METADATA);
- try {
- Set<IInstallableUnit> gavUnits = io.readXML(is);
-
- unitsMap.put(gav, gavUnits);
- units.addAll(gavUnits);
- } finally {
- is.close();
+ File localArtifactFileLocation = contentLocator.getLocalArtifactLocation(gav,
+ RepositoryLayoutHelper.CLASSIFIER_P2_METADATA, RepositoryLayoutHelper.EXTENSION_P2_METADATA);
+ if (!localArtifactFileLocation.exists()) {
+ // if files have been manually removed from the repository, simply adjust the meta info file (bug 351080)
+ projectIndex.remove(gav);
+ projectIndex.save();
+ } else {
+ InputStream is = contentLocator.getContents(gav, RepositoryLayoutHelper.CLASSIFIER_P2_METADATA,
+ RepositoryLayoutHelper.EXTENSION_P2_METADATA);
+ try {
+ Set<IInstallableUnit> gavUnits = io.readXML(is);
+
+ unitsMap.put(gav, gavUnits);
+ units.addAll(gavUnits);
+ } finally {
+ is.close();
+ }
}
} catch (IOException e) {
// TODO throw properly typed exception if repository cannot be loaded
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepository.java
index 173d4c0..d8e7681 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepository.java
@@ -27,7 +27,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
import org.eclipse.tycho.p2.maven.repository.xmlio.ArtifactsIO;
import org.eclipse.tycho.p2.repository.GAV;
import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
import org.eclipse.tycho.p2.repository.RepositoryReader;
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
@@ -41,8 +41,8 @@ public class LocalArtifactRepository extends AbstractMavenArtifactRepository {
}
public LocalArtifactRepository(IProvisioningAgent agent, File location) {
- super(agent, location.toURI(), new LocalTychoRepositoryIndex(location,
- LocalTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH), new LocalRepositoryReader(location));
+ super(agent, location.toURI(), FileBasedTychoRepositoryIndex.createRepositoryIndex(location,
+ FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH), new LocalRepositoryReader(location));
}
public LocalArtifactRepository(File location, TychoRepositoryIndex projectIndex, RepositoryReader contentLocator) {
@@ -52,8 +52,8 @@ public class LocalArtifactRepository extends AbstractMavenArtifactRepository {
private void saveMaven() {
File location = getBasedir();
- LocalTychoRepositoryIndex index = new LocalTychoRepositoryIndex(location,
- LocalTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
+ TychoRepositoryIndex index = FileBasedTychoRepositoryIndex.createRepositoryIndex(location,
+ FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
ArtifactsIO io = new ArtifactsIO();
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepositoryFactory.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepositoryFactory.java
index 3200b2a..71752d9 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepositoryFactory.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalArtifactRepositoryFactory.java
@@ -18,7 +18,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactRepositoryFactory;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.repository.util.RepositoryFactoryTools;
public class LocalArtifactRepositoryFactory extends ArtifactRepositoryFactory {
@@ -36,7 +36,7 @@ public class LocalArtifactRepositoryFactory extends ArtifactRepositoryFactory {
if ("file".equals(location.getScheme())) {
final File localRepositoryDirectory = new File(location);
if (localRepositoryDirectory.isDirectory()
- && new File(localRepositoryDirectory, LocalTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH).exists()) {
+ && new File(localRepositoryDirectory, FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH).exists()) {
return new LocalArtifactRepository(getAgent(), localRepositoryDirectory);
}
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalMetadataRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalMetadataRepository.java
index ac1cc51..28b3a22 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalMetadataRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/LocalMetadataRepository.java
@@ -20,7 +20,7 @@ import java.util.Set;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.tycho.p2.maven.repository.xmlio.MetadataIO;
import org.eclipse.tycho.p2.repository.GAV;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
import org.eclipse.tycho.p2.repository.RepositoryReader;
import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
@@ -76,9 +76,8 @@ public class LocalMetadataRepository extends AbstractMavenMetadataRepository {
public void save() {
File basedir = new File(getLocation());
- // XXX lock
- LocalTychoRepositoryIndex index = new LocalTychoRepositoryIndex(basedir,
- LocalTychoRepositoryIndex.METADATA_INDEX_RELPATH);
+ TychoRepositoryIndex index = FileBasedTychoRepositoryIndex.createRepositoryIndex(basedir,
+ FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH);
MetadataIO io = new MetadataIO();
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/MemoryTychoRepositoryIndex.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/MemoryTychoRepositoryIndex.java
index e404c23..41869b8 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/MemoryTychoRepositoryIndex.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/MemoryTychoRepositoryIndex.java
@@ -10,19 +10,25 @@
*******************************************************************************/
package org.eclipse.tycho.p2.maven.repository;
-import java.util.List;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.tycho.p2.repository.DefaultTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.GAV;
-import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
-public class MemoryTychoRepositoryIndex implements TychoRepositoryIndex {
- private List<GAV> projectGAVs;
+public class MemoryTychoRepositoryIndex extends DefaultTychoRepositoryIndex {
- public MemoryTychoRepositoryIndex(List<GAV> projectGAVs) {
- this.projectGAVs = projectGAVs;
+ public MemoryTychoRepositoryIndex(GAV... intitialContent) {
+ this(new HashSet<GAV>(Arrays.asList(intitialContent)));
}
- public List<GAV> getProjectGAVs() {
- return projectGAVs;
+ public MemoryTychoRepositoryIndex(Set<GAV> intitialContent) {
+ super(intitialContent);
+ }
+
+ public void save() throws IOException {
+ // In memory only
}
}
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleArtifactRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleArtifactRepository.java
index c2a4427..8aaece7 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleArtifactRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleArtifactRepository.java
@@ -12,7 +12,6 @@ package org.eclipse.tycho.p2.maven.repository;
import java.io.File;
import java.io.OutputStream;
-import java.util.Collections;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
@@ -43,7 +42,7 @@ public class ModuleArtifactRepository extends AbstractMavenArtifactRepository {
}
private static TychoRepositoryIndex createSingletonIndex(final GAV moduleGAV) {
- return new MemoryTychoRepositoryIndex(Collections.singletonList(moduleGAV));
+ return new MemoryTychoRepositoryIndex(moduleGAV);
}
@Override
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleMetadataRepository.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleMetadataRepository.java
index 310e949..613d251 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleMetadataRepository.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.maven.repository/src/main/java/org/eclipse/tycho/p2/maven/repository/ModuleMetadataRepository.java
@@ -12,7 +12,6 @@ package org.eclipse.tycho.p2.maven.repository;
import java.io.File;
import java.io.IOException;
-import java.util.Collections;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.tycho.p2.repository.AbstractRepositoryReader;
@@ -33,7 +32,7 @@ public class ModuleMetadataRepository extends AbstractMavenMetadataRepository {
}
private static TychoRepositoryIndex createDummyIndex() {
- return new MemoryTychoRepositoryIndex(Collections.<GAV> singletonList(null));
+ return new MemoryTychoRepositoryIndex(new GAV("g", "a", "v"));
}
private static class ModuleMetadataReader extends AbstractRepositoryReader {
diff --git a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
index 43571d1..100095f 100644
--- a/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
+++ b/tycho-p2-resolver/tycho-p2-resolver-impl/org.eclipse.tycho.p2.resolver.impl/src/main/java/org/eclipse/tycho/p2/impl/resolver/ResolutionContextImpl.java
@@ -70,8 +70,9 @@ import org.eclipse.tycho.p2.metadata.IArtifactFacade;
import org.eclipse.tycho.p2.metadata.IReactorArtifactFacade;
import org.eclipse.tycho.p2.repository.GAV;
import org.eclipse.tycho.p2.repository.LocalRepositoryReader;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryReader;
+import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
import org.eclipse.tycho.p2.resolver.facade.ResolutionContext;
import org.eclipse.tycho.p2.target.TargetDefinitionResolver;
import org.eclipse.tycho.p2.target.TargetPlatformContent;
@@ -138,10 +139,10 @@ public class ResolutionContextImpl implements ResolutionContext {
if (localRepository == null || localMetadataRepository == null) {
RepositoryReader contentLocator = new LocalRepositoryReader(localMavenRepositoryRoot);
- LocalTychoRepositoryIndex artifactsIndex = new LocalTychoRepositoryIndex(localMavenRepositoryRoot,
- LocalTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
- LocalTychoRepositoryIndex metadataIndex = new LocalTychoRepositoryIndex(localMavenRepositoryRoot,
- LocalTychoRepositoryIndex.METADATA_INDEX_RELPATH);
+ TychoRepositoryIndex artifactsIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(
+ localMavenRepositoryRoot, FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
+ TychoRepositoryIndex metadataIndex = FileBasedTychoRepositoryIndex.createRepositoryIndex(
+ localMavenRepositoryRoot, FileBasedTychoRepositoryIndex.METADATA_INDEX_RELPATH);
localRepository = new LocalArtifactRepository(localMavenRepositoryRoot, artifactsIndex, contentLocator);
localMetadataRepository = new LocalMetadataRepository(uri, metadataIndex, contentLocator);
diff --git a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/PomDependencyProcessor.java b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/PomDependencyProcessor.java
index 3627321..75902d4 100644
--- a/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/PomDependencyProcessor.java
+++ b/tycho-p2/tycho-p2-facade/src/main/java/org/eclipse/tycho/p2/resolver/PomDependencyProcessor.java
@@ -23,8 +23,10 @@ import org.apache.maven.repository.RepositorySystem;
import org.codehaus.plexus.logging.Logger;
import org.eclipse.tycho.p2.facade.RepositoryReferenceTool;
import org.eclipse.tycho.p2.facade.internal.ArtifactFacade;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.GAV;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
import org.eclipse.tycho.p2.repository.RepositoryLayoutHelper;
+import org.eclipse.tycho.p2.repository.TychoRepositoryIndex;
import org.eclipse.tycho.p2.resolver.facade.ResolutionContext;
public class PomDependencyProcessor {
@@ -41,7 +43,7 @@ public class PomDependencyProcessor {
void addPomDependenciesToResolutionContext(MavenProject project, Collection<Artifact> transitivePomDependencies,
ResolutionContext resolutionContext) {
- final LocalTychoRepositoryIndex p2ArtifactsInLocalRepo = loadIndexOfP2ArtifactsInLocalMavenRepo();
+ final TychoRepositoryIndex p2ArtifactsInLocalRepo = loadIndexOfP2ArtifactsInLocalMavenRepo();
for (Artifact artifact : transitivePomDependencies) {
P2DataArtifacts p2Data = new P2DataArtifacts(artifact);
@@ -67,8 +69,8 @@ public class PomDependencyProcessor {
* available in the build.
*/
// TODO this should happen in resolution context
- p2ArtifactsInLocalRepo.addProject(artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getVersion());
+ p2ArtifactsInLocalRepo.addProject(new GAV(artifact.getGroupId(), artifact.getArtifactId(), artifact
+ .getVersion()));
} else if (!p2Data.p2MetadataXml.isAvailable() && !p2Data.p2ArtifactsXml.isAvailable()) {
/*
@@ -102,9 +104,10 @@ public class PomDependencyProcessor {
* @see RepositoryReferenceTool#getVisibleRepositories(MavenProject, MavenSession, int)
* @see org.eclipse.tycho.p2.maven.repository.LocalArtifactRepository
*/
- private LocalTychoRepositoryIndex loadIndexOfP2ArtifactsInLocalMavenRepo() {
+ private TychoRepositoryIndex loadIndexOfP2ArtifactsInLocalMavenRepo() {
File localMavenRepository = new File(session.getLocalRepository().getBasedir());
- return new LocalTychoRepositoryIndex(localMavenRepository, LocalTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
+ return FileBasedTychoRepositoryIndex.createRepositoryIndex(localMavenRepository,
+ FileBasedTychoRepositoryIndex.ARTIFACTS_INDEX_RELPATH);
}
private void failDueToPartialP2Data(Artifact artifact, P2DataArtifacts p2Data) {
diff --git a/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/UpdateLocalIndexMojo.java b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/UpdateLocalIndexMojo.java
index 21ee06d..497a964 100644
--- a/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/UpdateLocalIndexMojo.java
+++ b/tycho-p2/tycho-p2-plugin/src/main/java/org/eclipse/tycho/plugins/p2/UpdateLocalIndexMojo.java
@@ -18,7 +18,7 @@ import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
-import org.eclipse.tycho.p2.repository.LocalTychoRepositoryIndex;
+import org.eclipse.tycho.p2.repository.FileBasedTychoRepositoryIndex;
/**
* @goal update-local-index
@@ -34,7 +34,7 @@ public class UpdateLocalIndexMojo extends AbstractMojo {
File location = new File(session.getLocalRepository().getBasedir());
try {
- LocalTychoRepositoryIndex.addProject(location, project.getGroupId(), project.getArtifactId(), project
+ FileBasedTychoRepositoryIndex.addProject(location, project.getGroupId(), project.getArtifactId(), project
.getArtifact().getVersion());
} catch (IOException e) {
throw new MojoExecutionException("Could not update local repository index", e);