无法用tycho构建一个没有POM的OSGi包

时间:2016-04-12 16:56:37

标签: maven osgi-bundle tycho polyglot

我有一个“Hello,World!” OSGi捆绑基于tycho的0.24 POM-less build example。项目根目录包含一个目录,其中包含名为com.softalks.tycho.bundle的包代码和以下构建配置文件

.mvn / extensions.xml

<?xml version="1.0" encoding="UTF-8"?>
<extensions>
    <extension>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-pomless</artifactId>
        <version>0.24.0</version>
    </extension>
</extensions>

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.softalks.tycho</groupId>
    <artifactId>com.softalks.tycho.parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <repositories>
        <repository>
            <id>luna</id>
            <url>http://download.eclipse.org/releases/luna</url>
            <layout>p2</layout>
        </repository>
    </repositories>

    <modules>
        <module>com.softalks.tycho.bundle</module>
    </modules>

    <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>0.24.0</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
</project>

我的构建环境:

Apache Maven 3.3.9
Java版本:1.7.0_95,供应商:Oracle Corporation
Java home:/ usr / lib / jvm / java-7-openjdk-amd64 / jre
操作系统名称:“linux”,版本:“3.13.0-61-generic”,arch:“amd64”,family:“unix”

Maven回应:

/home/runner/tycho/pom.xml的子模块/home/runner/tycho/com.softalks.tycho.bundle/pom.xml不存在

我也尝试将此添加到我的pom(如示例所示)但没有成功:

    <pluginRepositories>
        <pluginRepository>
            <id>tycho-snapshots</id>
            <url>https://repo.eclipse.org/content/repositories/tycho-snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

我做错了什么?

1 个答案:

答案 0 :(得分:0)

您必须在/home/runner/tycho/com.softalks.tycho.bundle/目录中提供pom.xml。是的'pomless'但是必须写这个目录中的父pom。

<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/maven-v4_0_0.xsd"> 

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.softalks.tycho</groupId>
    <artifactId>bundles</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>pom</packaging>

    <parent>
        <groupId>com.softalks.tycho</groupId>
        <artifactId>com.softalks.tycho.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <modules>
        <module>...All your modules...</module>
    </modules>

</project>

此处提到的模块目录中的所有pom.xml文件都将自动生成。