greg1
greg1

Reputation: 53

Tycho Compiler not picking up generated source code

I am fairly new to the world of maven and tycho, so hopefully this is just something obvious that I am missing. I am trying to build a plugin using tycho but I am unable to get the tycho-compiler-plugin to recognise source code that is generated as a part of the build process.

Here is a copy of a test pom that I've put together to demonstrate:

<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>

I have a java class in the src folder that references some of the generated source code, which then fails to compile.

If I remove tycho and use the standard maven-compiler-plugin, it automatically picks up the code generated during the build and the java class mentioned above compiles as expected.

Can someone tell me what I am doing wrong?

Upvotes: 5

Views: 1707

Answers (2)

jsievers
jsievers

Reputation: 1853

tycho compiler plugin uses source dirs configured in build.properties you have to make sure the generated source dir is referenced in build.properties

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

Upvotes: 6

SpaceTrucker
SpaceTrucker

Reputation: 13556

You have to add additional source folders for generated sources, in your case the wsdl dir.

See this question for help on that.

Tycho will then pick up those additional directories during compile.

Upvotes: -2

Related Questions