<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>wonttellya</groupId> <artifactId>wonttellya</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <dependencies> ... </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-eclipse-plugin</artifactId> <version>2.10</version> <configuration> <pde>true</pde> </configuration> </plugin> </plugins> </build> </project>
在控制台我运行
C:\Users\user\git\wonttellya\mvn eclipse:eclipse -Declipse.workspace=C:\Users\user\workspace2 ... Using Eclipse Workspace: C:\Users\user\workspace2 ... BUILD SUCCESS
如果我在工作空间中打开Eclipse,没有项目.
解决方法
maven-eclipse-plugin
的目的是引用其文档:
to generate Eclipse IDE files (*.classpath,*.project,*.wtpmodules and the .settings folder) for use with a project.
其目标不是创建一个整个项目,而是建立Eclipse阻止现有项目.
PDE支持也是如此. Quoting its documentation:
Note that the scope of the
maven-eclipse-plugin
is to synchronise the Eclipse.project
and.classpath
files with the configuration found in the pom file. Once you have finished configuring the Eclipse plugin as below,and once you have run theeclipse:eclipse
goal,you will be in a position to build your plugin code with the Eclipse IDE,or the Eclipse headless PDE build. The Eclipse headless PDE build can be triggered from within Maven using thepde-maven-plugin
.
因此,您只需简单地为现有项目创建正确的.project和.classpath文件即可.一旦这个配置已经完成,eclipse:eclipse目标运行,你将需要按照下列步骤:
>打开Eclipse并导入现有项目,转到“文件>导入…>现有项目进入工作区”.
>右键单击新项目,然后选择“配置>转换为插件项目…”.确认此选择.
然后,您可以直接在IDE中构建Eclipse插件.
请注意,我不建议使用此解决方案,我建议您使用Tycho,这可能是您可以对此插件进行改进(请参阅this question).