【Eclipse Maven Tycho】如何通过maven执行eclipse application

通过maven执行eclipse application

前言

eclipse其实不只是一个桌面(GUI)程序,他还可以是一个命令行程序。如果你的产品或软件是基于eclipse开发的,并且他没有UI相关的功能,那么就可以考虑把这些功能封装为一个独立的application,这样就可以通过命令行,在无界面的情况下去运行

命令行下运行

以eclipse自带的org.eclipse.equinox.p2.director为例,该application主要实现了操作p2仓库的相关功能,比如浏览给定仓库的内容,安装指定插件到指定的eclipse中等等。

–此处假设你已经安装了eclipse sdk或p2相关的插件

# 查看该app的帮助
./eclipse -nosplash -application org.eclipse.equinox.p2.director -help

# 列出给定仓库的所有插件
./eclipse -nosplash -application org.eclipse.equinox.p2.director -repository https://download.eclipse.org/releases/2022-12 -list

-nosplash 表示不显示启动页
-application org.eclipse.equinox.p2.director 表示运行id为org.eclipse.equinox.p2.director的application

通过maven tycho运行

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.zhangsan.test</groupId>
	<artifactId>product</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>pom</packaging>
	<build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.tycho.extras</groupId>
					<artifactId>tycho-eclipserun-plugin</artifactId>
					<version>3.6.0</version>
					<executions>
						<execution>
							<id>test</id>
							<phase>package</phase>
							<goals>
								<goal>eclipse-run</goal>
							</goals>
							<configuration>
								<addDefaultDependencies>true</addDefaultDependencies>
								<repositories>
									<repository>
										<layout>p2</layout>
										<url>https://download.eclipse.org/releases/2021-12</url>
									</repository>
								</repositories>
								<dependencies>
									<dependency>
										<artifactId>org.eclipse.platform</artifactId>
										<type>eclipse-feature</type>
									</dependency>
								</dependencies>
								<applicationsArgs>
									<args>-nosplash</args>
									<args>-application</args>
									<args>org.eclipse.equinox.p2.director</args>
									<args>-help</args>
								</applicationsArgs>
							</configuration>
						</execution>
					</executions>
				</plugin>
			</plugins>
		</pluginManagement>

		<plugins>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-p2-repository-plugin</artifactId>
				<version>3.6.0</version>
				<configuration>
					<includeAllDependencies>true</includeAllDependencies>
					<profileProperties>
						<macosx-bundled>true</macosx-bundled>
					</profileProperties>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

然后执行 mvn clean verify


  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值