Unable to see generated test source folder with mojo's build-helper

486 views Asked by At

I have added the mojo's plugin build-helper to my project pom to generate a new test source folder for my integration tests. When I run the phase, generate-test-sources

   mvn generate-test-sources

I could see the below console output showing the test source folder has generated, but When I look in project explorer, I don't see any folder which was created.

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for *******
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: com.google.guava:guava:jar -> version 18.0 vs ${guava.version} @ line 154, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.unitils:unitils-core:jar -> duplicate declaration of version 3.3 @ line 164, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building projectxxStaticAnalysisxxxxx versionxxxxx
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ StaticAnalysis ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ StaticAnalysis ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- build-helper-maven-plugin:1.9:add-test-source (add-integration-test-sources) @ StaticAnalysis ---
[INFO] Test Source directory: C:\{workspacepath}\src\integration-test\java added.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.421 s
[INFO] Finished at: 2014-11-25T11:26:59-06:00
[INFO] Final Memory: 9M/303M
[INFO] ------------------------------------------------------------------------    

Below is my pom plugin configuration

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9</version>
        <executions>
          <execution>
            <id>add-integration-test-sources</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/integration-test/java</source>
              </sources>
            </configuration>
          </execution>
        </executions>
</plugin>

Am I doing something wrong?. Please help.

Thanks

1

There are 1 answers

0
Praveen Reddy Katta On

I think I found the answer to my question. I was actually expecting build-helper plugin to create the test folder for me. But the fact is, it won't create the folder for you.

You have to create the test folder and use this build-helper plugin to tell maven to treat the folder you created as test folder as shown in my pom above. I was able fix my issue by creating a new test folder and ran the following command

mvn generate-test-sources eclipse:eclipse

Hope this helps someone!