Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a 'maven-p2-site' plugin #114

Closed
laeubi opened this issue May 3, 2021 · 6 comments
Closed

Create a 'maven-p2-site' plugin #114

laeubi opened this issue May 3, 2021 · 6 comments

Comments

@laeubi
Copy link
Member

laeubi commented May 3, 2021

With the mvn protocol in m2e and tycho we can now create update-sites that are defined completely on maven artifact references.
That means all the fetching, caching and mirror handling can be configured and reused by maven coordinates.

What is missing would be a module that allows for creating such site in a way that:

  1. it could be used in any project (even if not build with tycho) so projects building with any other maven technology can still use this to provide some convenience to P2 users.
  2. It simply uses all maven dependencies, generate the P2 metadata for them and create and appropriate p2 site that could be consumed using only the mvn protocol
  3. provide the necessary items and attach them to the project so this could be conveniently deployed to any maven repository (excluding the artifacts itself)

That way one could deploy the artifacts as-is to maven together with another set of items that could then be consumed as a regular P2 site.

@mickaelistria
Copy link
Contributor

I don't think the "provider" assistance to p2 is that interesting now that we have a better "consumer" story to consume plain Maven artifacts. IMO we should keep investing in Mave/p2 being simpler and simpler to consume artifacts from GAV directly than expecting producers will use such a mojo.
If you look at Platform build, it creates a p2 repo from Jetty GAV coordinates. It requires 2 files (pom + category). What would fit and match tis story would be for instance that we can get rid of the category.xml and in such, all the target-platform will be turned into a repository. It becomes only a single file to edit (pom.xml) with the list of artifacts to include in the repp.

@laeubi
Copy link
Member Author

laeubi commented May 4, 2021

What would fit and match tis story would be for instance that we can get rid of the category.xml and in such, all the target-platform will be turned into a repository. It becomes only a single file to edit (pom.xml) with the list of artifacts to include in the repp.

That's exactly what I'm currently developing here, but without the need of defining a platform (just plain maven deps). I simply want to enable 'plain maven' projects (like jetty) to publish P2 sites without additional effort (like felix/bnd plugin enables plain maven projects to publish OSGi metadata alongside with there usual build).

@laeubi laeubi self-assigned this May 4, 2021
@mickaelistria
Copy link
Contributor

without the need of defining a platform (just plain maven deps).

See https://git.eclipse.org/r/c/platform/eclipse.platform.releng.buildtools/+/176736/1/jetty.repository/pom.xml , only plain Maven deps, no platform.

simply want to enable 'plain maven' projects (like jetty) to publish P2 sites without additional effort

To be clear, those projects, including Jetty, have no strong interest in publishing p2 sites. The change in Platform is a consequence of Jetty not being interested in taking care of producing this extra artifact and thus not doing it on time, not testing and so on... That's why we got convinced expecting externa projects to publish p2 repositories is doomed to failure and think that the only good path now is facilitating consumption.

As mentioned earlier, I don't think a new plugin is necessary nor is the best solution. Such capability seems to fit very well into the current assemble-repository mojo.

@laeubi
Copy link
Member Author

laeubi commented May 4, 2021

Well that's the first patchset that has not fulfilled the requirements, if you take a look at the one merged a target was included, also it actually includes a target configuration that considers maven deps.

My current POC does not require all of this, just a simple pom with an additional mojo:

<?xml version="1.0" encoding="UTF-8"?>
<project>
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.eclipse.tycho.tycho-its.surefire</groupId>
	<artifactId>mvnp2site</artifactId>
	<packaging>pom</packaging>
	<version>1.0.0-SNAPSHOT</version>
	<properties>
		<target-platform>https://download.eclipse.org/releases/2021-03/</target-platform>
		<tycho-version>2.4.0-SNAPSHOT</tycho-version>
	</properties>
	<build>
		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho.extras</groupId>
				<artifactId>tycho-p2-extras-plugin</artifactId>
				<version>${tycho-version}</version>
				<executions>
					<execution>
						<id></id>
						<phase>package</phase>
						<goals>
							<goal>maven-p2-site</goal>
						</goals>
						<configuration>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.jetty</groupId>
			<artifactId>jetty-servlet</artifactId>
			<version>10.0.1</version>
			<type>jar</type>
		</dependency>
	</dependencies>
</project>

Beside of this, this could also used outside a "non p2 project" to produce an update site with zero duplication of artifacts (even not duplicated storage of them on a dedicated server).

@mickaelistria
Copy link
Contributor

it actually includes a target configuration that considers maven deps.

If I'm not mistaken, only missing stuff is missing sources. I guess, having sources in could most likely be added by specifying the
source artifact GAV (eg adding the classifier). The .target doesn't seem to be a full requirement here.

Looking at the pom you show here, I'm not convinced it's better than a pom that sets the target-platform-configuration/pomDependencies=consider ,

@laeubi
Copy link
Member Author

laeubi commented May 4, 2021

I guess, having sources in could most likely be added by specifying the
source artifact GAV (eg adding the classifier)

The problem is that you then need to convince the project to include (Eclipse specific) Bundle source header

Looking at the pom you show here, I'm not convinced it's better than a pom that sets the target-platform-configuration/pomDependencies=consider

This would require to build (at laest this module) with tycho specific packaging, while my approach would work for any packaging type (including BOM types). It also would not need category.xml or any other special file configuration to work. And as mentioned it won't need to deploy additional files to a special place, this is especially useful for large projects that are more than a few kilobytes large.

laeubi added a commit to laeubi/tycho that referenced this issue May 5, 2021
- add a PublisherApplication
- add first version of mojo

Signed-off-by: Christoph Läubrich <laeubi@laeubi-soft.de>
@mickaelistria mickaelistria added this to the 2.4 milestone Jun 29, 2021
mickaelistria added a commit to mickaelistria/tycho that referenced this issue Jun 29, 2021
tycho-p2-repository-plugin:assemble-maven-repository

+ N&N documentation
mickaelistria added a commit that referenced this issue Jun 29, 2021
tycho-p2-repository-plugin:assemble-maven-repository

+ N&N documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants