可能重复:
如何在tycho中引用mockito?
我正在尝试使用Tycho构建一个测试功能项目,但它无法解决我父pom中列出的Maven中央存储库中我的pom中列出的依赖项.这是我父母pom的相关部分:
<properties>
<tycho-version>0.12.0</tycho-version>
</properties>
<repositories>
<repository>
<id>helios</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/helios/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Maven Plugin Repository</name>
<url>http://repo1.maven.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
<resolver>p2</resolver>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
在这里我的功能pom:
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>parent</artifactId>
<groupId>com.example</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.example</groupId>
<artifactId>com.example.testing.feature</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
</dependency>
</dependencies>
</dependencyManagement> …Run Code Online (Sandbox Code Playgroud) tycho-p2-director-plugin似乎没有办法在最终的ZIP文件名中添加版本号.它产生
myproduct-win32.win32.x86.zip
myproduct-macosx.cocoa.x86.zip
myproduct-linux.gtk.x86.zip
Run Code Online (Sandbox Code Playgroud)
虽然我想拥有
myproduct-1.6.0-win32.zip
myproduct-1.6.0-linux32.zip
myproduct-1.6.0-macos.zip
Run Code Online (Sandbox Code Playgroud)
什么是最好的方式?不知何故用maven-antrun-plugin重命名?用maven资源插件重命名?什么东西?
我有一个基于OSGi的应用程序的Maven/Tycho构建,偶尔会因例外而失败.
我有大约20个eclipse功能,它似乎与实际功能没有任何关系(它可能是每次都失败的不同功能,并且通常构建工作正常)
这不是灾难,但我想在某些时候解决这个问题,而且我真的不知道如何调试这个进一步没有潜入Tycho代码或开始乱用随机设置.
这对任何人都响了吗?
系统:Fedora Linux JVM:OpenJDK运行时环境(IcedTea6 1.11.3)(fedora-67.1.11.3.fc16-x86_64)Maven:3.0.3 Tycho:0.15.0
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.tycho:tycho-packaging-plugin:0.15.0:package-feature (default-package-feature) on project com.dexels.navajo.tipi.swing.feature: Execution default-package-feature of goal org.eclipse.tycho:tycho-packaging-plugin:0.15.0:package-feature failed: com.dexels.navajo:com.dexels.navajo.tipi.swing.deps:eclipse-plugin:1.2.1-SNAPSHOT does not provide an artifact with classifier 'null'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:225)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:98)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:64)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:287)
at …Run Code Online (Sandbox Code Playgroud) 请考虑以下情形:我的应用程序对我自己的POM第一个工件(使用纯Maven构建)有一些依赖关系,并且依赖于我自己的清单第一个工件(使用Tycho构建).对于POM第一个工件,Tycho解析了我在POM中指定的版本.对于清单优先工件,Tycho解析了可能具有更高版本的本地构建的单元.
在我的具体案例中,我在pom.xml中为版本1.2.0中的清单优先工件指定了一个依赖项,但我收到警告"以下本地构建的单元已用于解决项目依赖关系",版本为1.3.0.2012xxx .
我已经发现了以下错误和讨论,但我不明白为什么Tycho解决POM-first和manifest-first依赖关系存在差异.
我在Java应用程序和RCP应用程序之间有共同的代码.所以我创建了一个OSGI包,其中包含:
我用Tycho Manifest-first构建了所有内容,并且它工作正常,直到我需要在我的公共代码中使用外部jar.
我需要使用jsch所以我在我的MANIFEST.MF中添加了jsch:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Main-Class: mygroupid.Main
Bundle-Name: Common tools
Bundle-SymbolicName: common-tools
Bundle-Version: 1.0.1.qualifier
Export-Package: mygroupid,
mygroupid.tools
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.osgi.framework;version="1.3.0"
Require-Bundle: com.jcraft.jsch;bundle-version="0.1.46"
Run Code Online (Sandbox Code Playgroud)
我用Tycho构建我的RCP应用程序,它可以工作.但是当我将包作为纯JAR运行时java -jar myjar.jar,我收到以下错误:
Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException
Run Code Online (Sandbox Code Playgroud)
如果我用Eclipse导出我的包,它就可以了.所以我的tycho配置有错误...
如何解决这个问题呢 ?对Tycho有依赖的jar吗?似乎不是这样的我错过了什么?
(我的配置:带有m2e的Eclipse Juno,Tycho 0.16.0,p2:Juno,Tycho:打包> eclipse-plugin,target-platform-configuration:resolver = p2和pomDependencies =考虑.)
我的RCP是在3.x Eclipse上创建的,现在使用兼容层在4.x上.这是我的设置:我有两个插件:xyz-plugin和xyz-rcp-plugin.我的RCP应用程序由这两个插件组成.我有一个Test片段(xyz-test),其主机插件是xyz-plugin并包含SWTBot测试.我的产品配置指向plugin.xml中定义的应用程序xyz-rcp-plugin.
当我通过Eclipse运行SWTBot测试时,一切正常.我将它指向Main选项卡上的正确应用程序,它会启动正确的应用程序.
当我尝试通过Maven(使用mvn integration-test)运行它时,在启动用于测试的UI的命令之后,没有UI打开,它只是报告说有测试失败但它实际上甚至从未到达测试我的案例的阶段.
我觉得这种情况正在发生,因为我的测试片段只有xyz-plugin其主机,因此知道它的依赖性,但实际上包含应用程序,xyz-rcp-plugin所以我猜它不会将该插件带入测试工作区.实际上,当我省略<application>pom文件中的配置时,测试运行; 它简单地启动默认的Eclipse SDK.
那么,如果带有应用程序的插件不是测试插件的依赖项,我如何让SWTBot测试运行我的应用程序?
下面是我的测试片段的pom文件,
<?xml version="1.0" encoding="UTF-8"?>
<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>
<parent>
<groupId>com.xyz</groupId>
<artifactId>all</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.xyz.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<properties>
<ui.test.vmargs></ui.test.vmargs>
</properties>
<profiles>
<profile>
<id>macosx</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<ui.test.vmargs>-XstartOnFirstThread</ui.test.vmargs>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>com.xyz.rcp.product</product>
<application>com.xyz.rcp.Application</application>
<argLine>${ui.test.vmargs}</argLine>
<dependencies>
<dependency>
<!-- explicit dependency is only needed …Run Code Online (Sandbox Code Playgroud) 我需要确认我怀疑的内容,因为我找不到任何文档,所以这似乎是一个愚蠢的问题,因为我是eclipse PDE的学习者.
原来,
我有一个eclipse插件项目的父项目pom
<version>1.1.0-SNAPSHOT</version>
Run Code Online (Sandbox Code Playgroud)
有两个子项目,他们的poms引用父pom为版本1.1.0-SNAPSHOT.
我能够成功构建项目并拥有一个用于将插件安装到eclipse中的站点.
然后,我想要我的个人临时版本叫做1.1.1-mine.所以我将三个poms修改为1.1.1-mine
我还更新了META-INF/MANIFEST.MF和feature.xml
0.13.0.qualifier
Run Code Online (Sandbox Code Playgroud)
至
0.13.1.qualifier
Run Code Online (Sandbox Code Playgroud)
但是,构建遇到以下错误.
[错误]无法在项目org.sonatype.m2e.subclipse上执行目标org.eclipse.tycho:tycho-packaging-plugin:0.15.0:validate-version(default-validate-version):OSGi版本1.1.1.qualifier在META-INF/MANIFEST.MF中,与pom.xml中的Maven版本1.1.1-mine不匹配
不限定必须是一个行家版关键字?因为,我在poms中将我的更改为SNAPSHOT后,构建过程没有错误.
如果没有,我做错了什么?
我能做些什么来让我拥有版本1.1.1-mine?
我有几个OSGi捆绑包,这些捆绑包是在Eclipse中使用正常的清单管理的依赖关系以及使用Maven Tycho进行的外部构建而构建的。
在Equinox上的Eclipse内部运行捆绑软件可以正常工作。用Tycho构建它们可以正常工作。
现在,我想使用Tycho Surefire来运行集成测试,为此,我创建了一个包含一些基本测试的简单测试包。被测试的捆绑包依赖于OSGi容器中存在的其他捆绑包以及一些较小的启动级别调整才能正常运行-就像我说的那样,当在Equinox上正常运行捆绑包时,捆绑包本身启动时就可以正常运行。
因此,为了模仿Tycho Surefire,我在测试包的pom.xml中指定了以下内容:
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>0.21.0</version>
<configuration>
<bundleStartLevel>
<bundle>
<id>org.hibernate.osgi</id>
<level>6</level>
<autoStart>true</autoStart>
</bundle>
<!-- plus a few more bundles in the real pom.xml -->
</bundleStartLevel>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<configuration>
<dependency-resolution>
<extraRequirements>
<requirement>
<type>eclipse-plugin</type>
<id>org.hibernate.entitymanager</id>
<versionRange>4.2.12.Final</versionRange>
</requirement>
<requirement>
<type>eclipse-plugin</type>
<id>org.hibernate.osgi</id>
<versionRange>4.2.12.Final</versionRange>
</requirement>
<!-- plus a few more bundles in the real pom.xml -->
</extraRequirements>
</dependency-resolution>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
有趣的是,测试失败了。经过一些研究,我发现在失败的测试运行期间/之后如何访问OSGi控制台以进一步调查问题(运行tycho测试后的OSGi控制台)。
我的发现是,尽管OSGi容器中存在所有必需的捆绑软件(所有可传递衍生的捆绑软件和所有手动指定的捆绑软件),但只有具有独特特征<bundleStartLevel>的捆绑软件才被启动(当然还有OSGi-core-bundles)。
因此,考虑上面的例子中,我发现是,虽然双方org.hibernate.osgi并org.hibernate.entitymanager已得到解决,只有第一个是在“有效”状态。这显然使整个启动混乱,并且我的猜测是,如果捆绑包按预期启动,则测试可以正常运行。
当我查看“常规” Eclipse-OSGi-Launch配置时,有一个参数“ …
我们有一个eclipse Luna插件应用程序,我们正试图用Tycho构建.当我们尝试做一个mvn clean verify,我们得到这种类型的消息:
[ERROR] Cannot resolve project dependencies:
[ERROR] Software being installed: our.app 1.0.0.qualifier
[ERROR] Missing requirement: our.app 1.0.0.qualifier requires 'bundle org.eclipse.core.runtime 3.7.0' but it could not be found
Run Code Online (Sandbox Code Playgroud)
当我们查看日志时,似乎所需的任何Eclipse插件都会给我们这个错误,而这只是MANIFEST.MF列表中第一个被验证插件的项目.
我看过其他问题,但似乎都没有解决这个问题.任何建议将不胜感激.
MANIFEST.MF:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Our App
Bundle-SymbolicName: our.app;singleton:=true
Built-By: Our Team (2014)
Bundle-ClassPath: .,
<some jars>
Bundle-Vendor: Our Team
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.eclipse.ui;bundle-version="3.7.0",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.core.resources;bundle-version="3.7.0",
org.eclipse.ui.forms;bundle-version="3.6.0",
org.eclipse.wst.sse.ui;bundle-version="1.3.0",
org.eclipse.jface.text;bundle-version="3.8.100",
org.eclipse.ui.workbench.texteditor;bundle-version="3.8.101",
org.eclipse.ui.views;bundle-version="3.6.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Version: 1.0.0.qualifier
Run Code Online (Sandbox Code Playgroud) 如何使用tycho构建基于Java 11的Eclipse RCP应用?
我正在使用eclipse 2018-09 RCP + Java 11插件+ OpenJDK 11
我的应用程序是基于插件的,并且在所有插件中,MANIFEST.MF文件包含:
Bundle-RequiredExecutionEnvironment: JavaSE-11
Run Code Online (Sandbox Code Playgroud)
tycho构建因以下异常而失败:
[ERROR] Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST {...}\META-INF\MANIFEST.MF: Unknown OSGi execution environment: 'JavaSE-11' -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: org.eclipse.tycho.core.osgitools.OsgiManifestParserException: Exception parsing OSGi MANIFEST {...}\META-INF\MANIFEST.MF: Unknown OSGi execution environment: 'JavaSE-11'
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:120)
{...}
Caused by: org.eclipse.tycho.core.ee.UnknownEnvironmentException: Unknown OSGi execution environment: 'JavaSE-11'
at org.eclipse.tycho.core.ee.ExecutionEnvironmentUtils.getExecutionEnvironment(ExecutionEnvironmentUtils.java:84)
at org.eclipse.tycho.core.osgitools.OsgiManifest.parseExecutionEnvironments(OsgiManifest.java:66)
... 24 more
Run Code Online (Sandbox Code Playgroud)
tycho与Java 11兼容吗?如果是的话,如何配置它来构建Java 11 RCP应用程序?
我发现这篇文章非常相似(适用于Java 10 ...)