【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相关的插件

bash 复制代码
# 查看该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运行

xml 复制代码
<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


相关推荐
sheji34164 小时前
【开题答辩全过程】以 面向高校校园的物物交换系统设计与实现为例,包含答辩的问题和答案
java·eclipse
vx1_Biye_Design10 小时前
基于web的物流管理系统的设计与实现-计算机毕业设计源码44333
java·前端·spring boot·spring·eclipse·tomcat·maven
毕设源码-赖学姐15 小时前
【开题答辩全过程】以 高校素拓分管理系统的设计与开发为例,包含答辩的问题和答案
java·eclipse
Remember_9932 天前
Java 入门指南:从零开始掌握核心语法与编程思想
java·c语言·开发语言·ide·python·leetcode·eclipse
Remember_9933 天前
【JavaSE】一站式掌握Java面向对象编程:从类与对象到继承、多态、抽象与接口
java·开发语言·数据结构·ide·git·leetcode·eclipse
Remember_9933 天前
深入理解 Java String 类:从基础原理到高级应用
java·开发语言·spring·spring cloud·eclipse·tomcat
毕设源码-朱学姐4 天前
【开题答辩全过程】以 公寓楼设备报修管理系统为例,包含答辩的问题和答案
java·eclipse
二哈喇子!4 天前
Eclipse中导入外部jar包
java·eclipse·jar
二哈喇子!5 天前
controller & service & dao之间的关系
java·eclipse·intellij-idea
毕设源码-邱学长6 天前
【开题答辩全过程】以 台球俱乐部管理系统为例,包含答辩的问题和答案
java·eclipse