From 7c59dbea4079c08aacd0bd1d1f59d96d5fc7c37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 12 Aug 2024 07:36:24 +0200 Subject: [PATCH] Remove TychoTeslaProjectBuilder workaround This is fixed with https://github.com/takari/polyglot-maven/pull/257 and released with version 0.5.0 --- .../pomless/TychoTeslaProjectBuilder.java | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 tycho-extras/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoTeslaProjectBuilder.java diff --git a/tycho-extras/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoTeslaProjectBuilder.java b/tycho-extras/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoTeslaProjectBuilder.java deleted file mode 100644 index 9369467c3d..0000000000 --- a/tycho-extras/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoTeslaProjectBuilder.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2023 Christoph Läubrich and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Christoph Läubrich - initial API and implementation - * - *******************************************************************************/ -package org.eclipse.tycho.pomless; - -import java.lang.reflect.Field; - -import javax.annotation.Priority; - -import org.apache.maven.project.DefaultProjectBuilder; -import org.apache.maven.project.ProjectBuilder; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable; -import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException; -import org.sonatype.maven.polyglot.TeslaProjectBuilder; - -@Component(role = ProjectBuilder.class) -@Priority(10) -public class TychoTeslaProjectBuilder extends TeslaProjectBuilder implements Initializable, ProjectBuilder { - - @Override - public void initialize() throws InitializationException { - try { - // Workaround for https://github.com/takari/polyglot-maven/pull/256 - // and https://github.com/takari/polyglot-maven/pull/257 - Field field = DefaultProjectBuilder.class.getDeclaredField("modelCacheFactory"); - field.setAccessible(true); - Object value = field.get(this); - if (value == null) { - Class clazz = getClass().getClassLoader() - .loadClass("org.apache.maven.repository.internal.DefaultModelCacheFactory"); - Object instance = clazz.getConstructor().newInstance(); - field.set(this, instance); - } - } catch (Exception e) { - } - } -}