Tycho编译器没有获取生成的源代码

时间:2013-03-05 06:36:51

标签: maven tycho generated-code

我对maven和tycho的世界相当新,所以希望这只是我遗漏的明显事物。我正在尝试使用tycho构建一个插件,但是我无法使用tycho-compiler-plugin来识别作为构建过程的一部分生成的源代码。

以下是我一起展示的测试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/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>rt</groupId>
    <artifactId>rt.webservice</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>eclipse-plugin</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <tycho-version>0.16.0</tycho-version>
    </properties>

    <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>tycho-compiler-plugin</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                    <verbose>true</verbose>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>1.12</version>
                <executions>
                    <execution>
                        <id>generate-ws-code</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlDirectory>${basedir}/wsdl</wsdlDirectory>
                            <verbose>true</verbose>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

</project>

我在src文件夹中有一个java类,它引用了一些生成的源代码,然后无法编译。

如果我删除tycho并使用标准的maven-compiler-plugin,它会自动获取构建期间生成的代码,上面提到的java类按预期编译。

有人能告诉我我做错了吗?

2 个答案:

答案 0 :(得分:4)

tycho编译器插件使用build.properties中配置的源目录 您必须确保在build.properties

中引用生成的源目录

http://jax-ws-commons.java.net/jaxws-maven-plugin/wsimport-mojo.html#sourceDestDir

答案 1 :(得分:-2)

您必须为生成的源添加其他源文件夹,例如wsdl目录。

请参阅this question以获取相关帮助。

然后Tycho将在编译期间获取这些额外的目录。

相关问题