diff --git a/target-platform-configuration/pom.xml b/target-platform-configuration/pom.xml index c438678d54..ac0e4bf1fd 100644 --- a/target-platform-configuration/pom.xml +++ b/target-platform-configuration/pom.xml @@ -29,8 +29,8 @@ - org.codehaus.plexus - plexus-component-metadata + org.eclipse.sisu + sisu-maven-plugin org.apache.maven.plugins @@ -44,6 +44,18 @@ + + javax.inject + javax.inject + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + org.apache.maven maven-core diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/MirrorTargetPlatformMojo.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/MirrorTargetPlatformMojo.java index 3e85d86a02..8edf40e805 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/MirrorTargetPlatformMojo.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/MirrorTargetPlatformMojo.java @@ -22,7 +22,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -53,6 +52,8 @@ import org.eclipse.tycho.p2maven.SlicingOptions; import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManager; +import javax.inject.Inject; + /** * Supports mirroring the computed target platform of the current project, this behaves similar to * what PDE offers with its export deployable feature / plug-in and assembles an update site that @@ -104,19 +105,19 @@ public class MirrorTargetPlatformMojo extends AbstractMojo { @Parameter private SlicingOptions options; - @Component + @Inject private TargetPlatformService platformService; - @Component + @Inject private MirrorApplicationService mirrorService; - @Component + @Inject private ReactorRepositoryManager repositoryManager; - @Component + @Inject private IProvisioningAgent agent; - @Component + @Inject private InstallableUnitSlicer installableUnitSlicer; @Override diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetArtifactRepositoryLayout.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetArtifactRepositoryLayout.java index 2830820564..51ec3edfeb 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetArtifactRepositoryLayout.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetArtifactRepositoryLayout.java @@ -19,9 +19,12 @@ import org.apache.maven.artifact.repository.MavenArtifactRepository; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout; import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2; -import org.codehaus.plexus.component.annotations.Component; -@Component(role = ArtifactRepositoryLayout.class, hint = TargetArtifactRepositoryLayout.ID) +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named(TargetArtifactRepositoryLayout.ID) public class TargetArtifactRepositoryLayout implements ArtifactRepositoryLayout, ArtifactRepositoryLayout2 { public static final String ID = "target"; diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java index db8720fd9d..01125d85f4 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformConfigurationInstallableUnitProvider.java @@ -21,9 +21,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; import org.eclipse.core.runtime.CoreException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IRequirement; @@ -39,20 +36,22 @@ import org.eclipse.tycho.p2maven.tmp.BundlesAction; import org.eclipse.tycho.resolver.InstallableUnitProvider; +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + /** * Provides additional requirements defined in the target platform configuration * */ -@Component(role = InstallableUnitProvider.class, hint = "target") +@Singleton +@Named("target") public class TargetPlatformConfigurationInstallableUnitProvider implements InstallableUnitProvider { - @Requirement + @Inject private DefaultTargetPlatformConfigurationReader configurationReader; - @Requirement - private Logger logger; - - @Requirement + @Inject private TychoProjectManager projectManager; @Override @@ -89,7 +88,6 @@ private static IRequirement createRequirementFor(String type, String id, Version } private static IInstallableUnit createUnitRequiring(Collection requirements) { - InstallableUnitDescription result = new MetadataFactory.InstallableUnitDescription(); result.setId("target-platform-extra-requirements-" + UUID.randomUUID()); result.setVersion(Version.createOSGi(0, 0, 0, String.valueOf(System.currentTimeMillis()))); diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformMojo.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformMojo.java index a21ad6f99a..4ca761221a 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformMojo.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetPlatformMojo.java @@ -16,7 +16,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; @@ -24,6 +23,8 @@ import org.eclipse.tycho.TargetPlatformService; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; +import javax.inject.Inject; + @Mojo(name = "target-platform", threadSafe = true) public class TargetPlatformMojo extends AbstractMojo { @@ -33,7 +34,7 @@ public class TargetPlatformMojo extends AbstractMojo { @Parameter(property = "project", readonly = true) private MavenProject project; - @Component + @Inject private TargetPlatformService platformService; @Override diff --git a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetRepositoryConnectorFactory.java b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetRepositoryConnectorFactory.java index 54cc20eefa..2becafe6f5 100644 --- a/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetRepositoryConnectorFactory.java +++ b/target-platform-configuration/src/main/java/org/eclipse/tycho/target/TargetRepositoryConnectorFactory.java @@ -12,14 +12,18 @@ *******************************************************************************/ package org.eclipse.tycho.target; -import org.codehaus.plexus.component.annotations.Component; +import org.apache.maven.plugins.annotations.Mojo; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.spi.connector.RepositoryConnector; import org.eclipse.aether.spi.connector.RepositoryConnectorFactory; import org.eclipse.aether.transfer.NoRepositoryConnectorException; -@Component(role = RepositoryConnectorFactory.class, hint = TargetArtifactRepositoryLayout.ID) +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named(TargetArtifactRepositoryLayout.ID) public class TargetRepositoryConnectorFactory implements RepositoryConnectorFactory { @Override diff --git a/tycho-ds-plugin/pom.xml b/tycho-ds-plugin/pom.xml index 89933d5b25..3f921bf596 100644 --- a/tycho-ds-plugin/pom.xml +++ b/tycho-ds-plugin/pom.xml @@ -13,6 +13,18 @@ Tycho OSGi Declarative Services Plugin A plugin for handling OSGi Declarative Services + + javax.inject + javax.inject + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + org.apache.maven maven-core @@ -29,6 +41,10 @@ org.codehaus.plexus plexus-utils + + org.codehaus.plexus + plexus-xml + org.eclipse.tycho tycho-core @@ -42,8 +58,8 @@ - org.codehaus.plexus - plexus-component-metadata + org.eclipse.sisu + sisu-maven-plugin org.apache.maven.plugins diff --git a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServiceConfigurationReader.java b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServiceConfigurationReader.java index 824fc9ab52..f96e1241a3 100644 --- a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServiceConfigurationReader.java +++ b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServiceConfigurationReader.java @@ -21,15 +21,18 @@ import org.apache.maven.model.Plugin; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; -import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.xml.Xpp3Dom; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.DeclarativeServicesConfiguration; import org.osgi.framework.Version; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; -@Component(role = DeclarativeServiceConfigurationReader.class) +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named public class DeclarativeServiceConfigurationReader { private static final String DS_PLUGIN = "org.eclipse.tycho:tycho-ds-plugin"; @@ -44,8 +47,7 @@ public class DeclarativeServiceConfigurationReader { private static final String PDE_DS_ANNOTATIONS_PREFS = ".settings/org.eclipse.pde.ds.annotations.prefs"; - @Requirement - private Logger logger; + private final Logger logger = LoggerFactory.getLogger(getClass()); public DeclarativeServicesConfiguration getConfiguration(ReactorProject reactorProject) throws IOException { return getConfiguration(Objects.requireNonNull(reactorProject.adapt(MavenProject.class))); diff --git a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesClasspathContributor.java b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesClasspathContributor.java index 68b709de2c..30e954ea06 100644 --- a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesClasspathContributor.java +++ b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesClasspathContributor.java @@ -18,13 +18,12 @@ import java.util.Optional; import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; -import org.apache.maven.SessionScoped; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.tycho.ArtifactKey; import org.eclipse.tycho.ResolvedArtifactKey; @@ -34,6 +33,7 @@ import org.eclipse.tycho.core.TychoProjectManager; import org.eclipse.tycho.core.maven.MavenDependenciesResolver; import org.eclipse.tycho.core.osgitools.AbstractSpecificationClasspathContributor; +import org.eclipse.tycho.core.osgitools.MavenBundleResolver; import org.osgi.framework.Version; import org.osgi.framework.VersionRange; @@ -43,8 +43,8 @@ import aQute.bnd.osgi.Constants; import aQute.bnd.osgi.Processor; -@Component(role = ClasspathContributor.class, hint = "ds-annotations") -@SessionScoped +@Singleton +@Named("ds-annotations") public class DeclarativeServicesClasspathContributor extends AbstractSpecificationClasspathContributor implements ClasspathContributor { @@ -56,18 +56,18 @@ public class DeclarativeServicesClasspathContributor extends AbstractSpecificati private static final String DS_ANNOTATIONS_1_2_ARTIFACT_ID = "osgi.cmpn"; private static final String DS_ANNOTATIONS_1_2_VERSION = "5.0.0"; - @Requirement + @Inject DeclarativeServiceConfigurationReader configurationReader; - @Requirement + @Inject MavenDependenciesResolver dependenciesResolver; - @Requirement + @Inject TychoProjectManager projectManager; @Inject - public DeclarativeServicesClasspathContributor(MavenSession session) { - super(session, DS_ANNOTATIONS_PACKAGE, DS_ANNOTATIONS_GROUP_ID, DS_ANNOTATIONS_ARTIFACT_ID); + public DeclarativeServicesClasspathContributor(MavenBundleResolver mavenBundleResolver, MavenSession session) { + super(mavenBundleResolver, session, DS_ANNOTATIONS_PACKAGE, DS_ANNOTATIONS_GROUP_ID, DS_ANNOTATIONS_ARTIFACT_ID); } @Override diff --git a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesMojo.java b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesMojo.java index e7e502cf8a..0fa1ac9cae 100644 --- a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesMojo.java +++ b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/DeclarativeServicesMojo.java @@ -23,8 +23,6 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -46,6 +44,10 @@ import aQute.bnd.osgi.Constants; import aQute.bnd.osgi.Jar; import aQute.bnd.osgi.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; /** * This mojo generates 0) { - log.info(generated + " component(s) where generated, " + keep + " where kept."); + logger.info(generated + " component(s) where generated, " + keep + " where kept."); } else { - log.info(generated + " component(s) where generated."); + logger.info(generated + " component(s) where generated."); } } } catch (Exception e) { diff --git a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/ServiceComponentManifestProcessor.java b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/ServiceComponentManifestProcessor.java index 9000018efb..d51aa1a935 100644 --- a/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/ServiceComponentManifestProcessor.java +++ b/tycho-ds-plugin/src/main/java/org/eclipse/tycho/ds/ServiceComponentManifestProcessor.java @@ -15,12 +15,15 @@ import java.util.jar.Manifest; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.osgitools.DefaultReactorProject; import org.eclipse.tycho.packaging.ManifestProcessor; -@Component(role = ManifestProcessor.class, hint = "scr") +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named("scr") public class ServiceComponentManifestProcessor implements ManifestProcessor { @Override diff --git a/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml b/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml index c8b238f511..fb20272c23 100644 --- a/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/tycho-maven-plugin/src/main/resources/META-INF/plexus/components.xml @@ -1,6 +1,8 @@ + + org.apache.maven.lifecycle.mapping.LifecycleMapping eclipse-plugin diff --git a/tycho-p2-publisher-plugin/pom.xml b/tycho-p2-publisher-plugin/pom.xml index 803ada996b..671f662b50 100644 --- a/tycho-p2-publisher-plugin/pom.xml +++ b/tycho-p2-publisher-plugin/pom.xml @@ -26,6 +26,18 @@ Tycho p2 Publisher Plugin + + javax.inject + javax.inject + + + org.slf4j + slf4j-api + + + org.slf4j + slf4j-simple + org.apache.maven maven-plugin-api @@ -67,8 +79,8 @@ - org.codehaus.plexus - plexus-component-metadata + org.eclipse.sisu + sisu-maven-plugin diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/AbstractPublishMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/AbstractPublishMojo.java index ac52c6e69f..390616870d 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/AbstractPublishMojo.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/AbstractPublishMojo.java @@ -16,19 +16,20 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.eclipse.tycho.DependencySeed; import org.eclipse.tycho.core.maven.AbstractP2Mojo; import org.eclipse.tycho.p2.tools.publisher.facade.PublisherServiceFactory; import org.eclipse.tycho.p2tools.RepositoryReferenceTool; +import javax.inject.Inject; + public abstract class AbstractPublishMojo extends AbstractP2Mojo { private static final Object LOCK = new Object(); - @Component + @Inject private RepositoryReferenceTool repositoryReferenceTool; - @Component() + @Inject PublisherServiceFactory publisherServiceFactory; @Override diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishCategoriesMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishCategoriesMojo.java index 8af373d006..22a0a69110 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishCategoriesMojo.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishCategoriesMojo.java @@ -21,7 +21,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -29,14 +28,14 @@ import org.codehaus.plexus.util.FileUtils; import org.eclipse.tycho.BuildDirectory; import org.eclipse.tycho.DependencySeed; -import org.eclipse.tycho.PackagingType; -import org.eclipse.tycho.core.TychoProject; import org.eclipse.tycho.core.osgitools.EclipseRepositoryProject; import org.eclipse.tycho.model.Category; import org.eclipse.tycho.p2.tools.FacadeException; import org.eclipse.tycho.p2.tools.publisher.facade.PublisherService; import org.eclipse.tycho.p2.tools.publisher.facade.PublisherServiceFactory; +import javax.inject.Inject; + /** *

* Publishes the category definitions from the category.xml in the root of the project. @@ -47,7 +46,7 @@ @Mojo(name = "publish-categories", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) public final class PublishCategoriesMojo extends AbstractPublishMojo { - @Component(role = TychoProject.class, hint = PackagingType.TYPE_ECLIPSE_REPOSITORY) + @Inject private EclipseRepositoryProject eclipseRepositoryProject; /** diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishOsgiEEMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishOsgiEEMojo.java index 63a79e713b..e724889a7c 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishOsgiEEMojo.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishOsgiEEMojo.java @@ -19,19 +19,21 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.toolchain.ToolchainManager; -import org.codehaus.plexus.logging.Logger; import org.eclipse.tycho.DependencySeed; import org.eclipse.tycho.ExecutionEnvironment; import org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils; import org.eclipse.tycho.p2.tools.FacadeException; import org.eclipse.tycho.p2.tools.publisher.facade.PublisherService; import org.eclipse.tycho.p2.tools.publisher.facade.PublisherServiceFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; /** *

@@ -44,6 +46,8 @@ @Mojo(name = "publish-osgi-ee", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, threadSafe = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) public final class PublishOsgiEEMojo extends AbstractPublishMojo { + private final Logger logger = LoggerFactory.getLogger(getClass()); + /** *

* Comma-separated list of profile names to be published. Examples: JavaSE-11, JavaSE-17, @@ -58,12 +62,9 @@ public final class PublishOsgiEEMojo extends AbstractPublishMojo { @Parameter(defaultValue = "false") private boolean skip; - @Component + @Inject private ToolchainManager toolchainManager; - @Component - private Logger logger; - @Override protected Collection publishContent(PublisherServiceFactory publisherServiceFactory) throws MojoExecutionException, MojoFailureException { diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductInstallableUnitProvider.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductInstallableUnitProvider.java index b3ecfa3488..59dbc79ade 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductInstallableUnitProvider.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductInstallableUnitProvider.java @@ -22,8 +22,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Plugin; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.core.runtime.CoreException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.metadata.IRequirement; @@ -33,12 +31,17 @@ import org.eclipse.tycho.p2maven.actions.ProductFile2; import org.eclipse.tycho.resolver.InstallableUnitProvider; -@Component(role = InstallableUnitProvider.class, hint = PublishProductInstallableUnitProvider.HINT) +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named(PublishProductInstallableUnitProvider.HINT) public class PublishProductInstallableUnitProvider implements InstallableUnitProvider { static final String HINT = "publish-products"; - @Requirement + @Inject private InstallableUnitGenerator installableUnitGenerator; @Override diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMetadataProvider.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMetadataProvider.java index 46396a34c3..bdcc71391c 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMetadataProvider.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMetadataProvider.java @@ -6,8 +6,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.component.annotations.Component; -import org.codehaus.plexus.component.annotations.Requirement; import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.tycho.IDependencyMetadata; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; @@ -17,10 +15,15 @@ import org.eclipse.tycho.p2maven.InstallableUnitGenerator; import org.eclipse.tycho.resolver.P2MetadataProvider; -@Component(role = P2MetadataProvider.class, hint = PublishProductInstallableUnitProvider.HINT) +import javax.inject.Inject; +import javax.inject.Named; +import javax.inject.Singleton; + +@Singleton +@Named(PublishProductInstallableUnitProvider.HINT) public class PublishProductMetadataProvider implements P2MetadataProvider { - @Requirement + @Inject private InstallableUnitGenerator installableUnitGenerator; @Override diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java index fe7cfbef77..7dfbf592fa 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/PublishProductMojo.java @@ -30,7 +30,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -65,6 +64,9 @@ import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManager; import org.osgi.framework.Version; +import javax.inject.Inject; +import javax.inject.Provider; + /** *

* Publishes all product definitions files (*.product) that are present in the root of @@ -84,16 +86,16 @@ public final class PublishProductMojo extends AbstractPublishMojo { */ private static final String FLAVOR = "tooling"; - @Component(role = UnArchiver.class, hint = "zip") - private UnArchiver deflater; + @Inject + private Provider deflaterProvider; - @Component + @Inject private FileLockService fileLockService; - @Component(role = TychoProject.class, hint = PackagingType.TYPE_ECLIPSE_REPOSITORY) + @Inject private EclipseRepositoryProject eclipseRepositoryProject; - @Component + @Inject private ReactorRepositoryManager reactorRepoManager; /** @@ -224,6 +226,7 @@ private File getExpandedLauncherBinaries() throws MojoExecutionException, MojoFa try (var locked = fileLockService.lock(equinoxExecFeature)) { // unzip now then: unzipped.mkdirs(); + UnArchiver deflater = deflaterProvider.get(); deflater.setSourceFile(equinoxExecFeature); deflater.setDestDirectory(unzipped); deflater.extract(); diff --git a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/persistence/AttachPublishedArtifactsMojo.java b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/persistence/AttachPublishedArtifactsMojo.java index 26aa02e561..e6da8c253f 100644 --- a/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/persistence/AttachPublishedArtifactsMojo.java +++ b/tycho-p2-publisher-plugin/src/main/java/org/eclipse/tycho/plugins/p2/publisher/persistence/AttachPublishedArtifactsMojo.java @@ -19,15 +19,17 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.project.MavenProjectHelper; -import org.codehaus.plexus.logging.Logger; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; import org.eclipse.tycho.PublishingRepositoryFacade; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.core.maven.AbstractP2Mojo; import org.eclipse.tycho.repository.registry.facade.ReactorRepositoryManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.inject.Inject; /** *

@@ -40,15 +42,14 @@ public class AttachPublishedArtifactsMojo extends AbstractP2Mojo { private static final Object LOCK = new Object(); - @Component + private final Logger logger = LoggerFactory.getLogger(getClass()); + + @Inject private MavenProjectHelper projectHelper; - @Component() + @Inject ReactorRepositoryManager reactorRepoManager; - @Component - private Logger logger; - @Override public void execute() throws MojoExecutionException, MojoFailureException { synchronized (LOCK) {