Eclipse p2 and OSGi-r5 to Maven publisher library

A who helps with publishing p2 and OSGi-R5 repositories to a maven repository

Лицензия

Лицензия

Категории

Категории

Maven Компиляция и сборка
Группа

Группа

at.bestsolution
Идентификатор

Идентификатор

at.bestsolution.maven.publisher
Последняя версия

Последняя версия

1.1.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Eclipse p2 and OSGi-r5 to Maven publisher library
A who helps with publishing p2 and OSGi-R5 repositories to a maven repository
Ссылка на сайт

Ссылка на сайт

https://github.com/BestSolution-at/osgi-to-maven-publisher
Система контроля версий

Система контроля версий

https://github.com/BestSolution-at/osgi-to-maven-publisher

Скачать at.bestsolution.maven.publisher

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/at.bestsolution/at.bestsolution.maven.publisher/ -->
<dependency>
    <groupId>at.bestsolution</groupId>
    <artifactId>at.bestsolution.maven.publisher</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/at.bestsolution/at.bestsolution.maven.publisher/
implementation 'at.bestsolution:at.bestsolution.maven.publisher:1.1.1'
// https://jarcasting.com/artifacts/at.bestsolution/at.bestsolution.maven.publisher/
implementation ("at.bestsolution:at.bestsolution.maven.publisher:1.1.1")
'at.bestsolution:at.bestsolution.maven.publisher:jar:1.1.1'
<dependency org="at.bestsolution" name="at.bestsolution.maven.publisher" rev="1.1.1">
  <artifact name="at.bestsolution.maven.publisher" type="jar" />
</dependency>
@Grapes(
@Grab(group='at.bestsolution', module='at.bestsolution.maven.publisher', version='1.1.1')
)
libraryDependencies += "at.bestsolution" % "at.bestsolution.maven.publisher" % "1.1.1"
[at.bestsolution/at.bestsolution.maven.publisher "1.1.1"]

Зависимости

compile (6)

Идентификатор библиотеки Тип Версия
org.apache.commons : commons-compress jar 1.12
commons-io : commons-io jar 2.5
org.apache.maven.indexer : indexer-core jar 5.1.2-816025a
org.apache.maven.wagon : wagon-http-lightweight jar 2.3
org.eclipse.sisu : org.eclipse.sisu.plexus jar 0.3.3
org.sonatype.sisu : sisu-guice jar 3.2.6

Модули Проекта

Данный проект не имеет модулей.

osgi-to-maven-publisher

Library to publish Eclipse p2 and OSGi r5 repositories to a maven repository

Usage

This is a library so you can not use it directly to publish artifacts but you have to create your own application to customize the publishing process.

An example useage is the publishing process used by e(fx)clipse to publish the runtime build artefacts.

private static final String SNAPSHOT_URL = "https://oss.sonatype.org/content/repositories/snapshots/";
	private static final String RELEASE_URL = "https://oss.sonatype.org/service/local/staging/deploy/maven2/";
	private static final String REPOSITORY_ID = "sonatype";

	public static void main(String[] args) throws Throwable {
		Options options = new Options();
		options.addOption("snapshots", false, "Publish snapshots");
		options.addOption("mavenrepository",true, "Maven repository to publish the build to");
		options.addOption("mavenrepositoryid",true,"Id of the maven repository to publish to");
		options.addOption("p2repository", true, "P2 repository url");
		options.addOption("publishSubset", true, "Publishing subset allowed values ALL, PLATFORM, EFX");


		CommandLineParser parser = new DefaultParser();
	private static final String SNAPSHOT_URL = "https://oss.sonatype.org/content/repositories/snapshots/";
	private static final String RELEASE_URL = "https://oss.sonatype.org/service/local/staging/deploy/maven2/";
	private static final String REPOSITORY_ID = "sonatype";

	public static void main(String[] args) throws Throwable {
		Options options = new Options();
		options.addOption("snapshots", false, "Publish snapshots");
		options.addOption("mavenrepository",true, "Maven repository to publish the build to");
		options.addOption("mavenrepositoryid",true,"Id of the maven repository to publish to");
		options.addOption("p2repository", true, "P2 repository url");
		options.addOption("publishSubset", true, "Publishing subset allowed values ALL, PLATFORM, EFX");
		options.addOption("validateonly",false,"Validate if the content of the repository is mirrored and resolved correctly");

		CommandLineParser parser = new DefaultParser();
		CommandLine cmd = parser.parse(options, args);

		String repository = cmd.hasOption("snapshots") ? "http://download.eclipse.org/efxclipse/runtime-nightly/site_assembly.zip" : null;
		if( cmd.hasOption("p2repository") ) {
			repository = cmd.getOptionValue("p2repository");
		}

		Path file = null;

		if( repository != null ) {
			URL url = new URL(repository);
			file = Files.createTempFile("p2-repository", ".zip");
			try ( InputStream in = url.openStream();
					OutputStream out = Files.newOutputStream(file) ) {
				byte[] buf = new byte[1024 * 500];
				int l;
				int total = 0;
				while( (l = in.read(buf)) != -1 ) {
					out.write(buf, 0, l);
					total += l;
					System.out.println("Loaded bytes " + new DecimalFormat("#,##0.00").format(total / 1024.0 / 1024.0) + " MB");
				}
			}
		} else {
			System.exit(1);
		}

		String mavenRepoUrl = cmd.hasOption("snapshots") ? SNAPSHOT_URL : RELEASE_URL;
		if( cmd.hasOption("mavenrepository") ) {
			mavenRepoUrl = cmd.getOptionValue("mavenrepository");
		}
		String mavenrepositoryId = REPOSITORY_ID;
		if( cmd.hasOption("mavenrepositoryid") ) {
			mavenrepositoryId = cmd.getOptionValue("mavenrepositoryid");
		}

		P2ToMavenSax p = new P2ToMavenSax( file.toAbsolutePath().toString(), mavenRepoUrl, mavenrepositoryId);
		p.setMavenReplacementLookup( b -> {
			if( b.getBundleId().equals("org.sat4j.core") ) {
				return Optional.of(new OsgiToMaven.MavenDep("org.ow2.sat4j","org.ow2.sat4j.core"));
			} else if( b.getBundleId().equals("org.sat4j.pb") ) {
				return Optional.of(new OsgiToMaven.MavenDep("org.ow2.sat4j","org.ow2.sat4j.pb"));
			}
			return Optional.empty();
		});
		p.setSourceEnforced( b -> ! b.getBundleId().equals("org.antlr.runtime"));
		p.setBundleFilter( b -> { return ! (b.getBundleId().startsWith("org.eclipse.emf.codegen")
				|| b.getBundleId().startsWith("org.eclipse.emf.mwe")
				|| b.getBundleId().startsWith("org.eclipse.fx.ui.workbench3")
				|| b.getBundleId().equals("org.eclipse.xtext.generator")
				|| b.getBundleId().startsWith("org.eclipse.xtext")); });
		p.setGroupIdResolver( b -> {
			if( b.getBundleId().startsWith("org.eclipse.fx") ) {
				return "at.bestsolution.efxclipse.rt";
			}
			return "at.bestsolution.efxclipse.eclipse";
		});

		if( cmd.hasOption("publishSubset") && "PLATFORM".equals(cmd.getOptionValue("publishSubset")) ) {
			p.setPublishFilter( b -> ! b.getBundleId().startsWith("org.eclipse.fx") );
		} else if( cmd.hasOption("publishSubset") && "EFX".equals(cmd.getOptionValue("publishSubset")) ) {
			p.setPublishFilter( b -> b.getBundleId().startsWith("org.eclipse.fx") );
		}

		if( cmd.hasOption("validateonly") ) {
			p.validate();
		} else {
			p.publish();
			p.validate();
		}

		Files.delete(file);
	}
at.bestsolution

BestSolution.at EDV Systemhaus GmbH

Версии библиотеки

Версия
1.1.1
1.1.0
1.0.0