streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sieverssj <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Streams 41
Date Wed, 21 May 2014 20:05:54 GMT
Github user sieverssj commented on the pull request:

    https://github.com/apache/incubator-streams/pull/23#issuecomment-43807066
  
    Let me add to what Matt said.  First, you might be able to get away without explicitly
using classifiers since no one is depending on your test sources.  Instead you'll use dynamic
profile activation.
    
    In the past I've worked on projects that need to conditionally add source to a project
based on the JDK being used.  In our case it was Java 1.5 versus Java 1.6, but the same should
apply here.
    
    Basically, what you want to do is setup a profile that is automatically activated based
on the jdk.  For instance:
    ```
    <profile>
        <id>java7</id>
        <activation>
            <jdk>[1.7,]</jdk>
        </activation>
        ....
    ```
    In this case, the java7 profile would only be activated when running with Java 1.7 or
up.
    
    What you can then do is create a new folder src/test/java17/ that will contain the tests
that require Java 1.7 or up to execute.  Then in your java7 profile, you can use the [build-helper-maven-plugin](http://mojo.codehaus.org/build-helper-maven-plugin/add-test-source-mojo.html)'s
add-test-source goal to add your new folder.
    
    All told, your new profile would be something like this:
    ```
        <profile>
          <id>java7</id>
          <activation>
            <jdk>[1.7,]</jdk>
          </activation>
          <build>
            <plugins>
              <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${helper.version}</version>
                <executions>
                  <execution>
                    <id>add-test-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                      <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                      <sources>
                        <source>src/test/java17</source>
                      </sources>
                    </configuration>
                  </execution>
                </executions>
              </plugin>
            </plugins>
          </build>
        </profile>
    ```
    And that's it.  Btw, I didn't test this, so my syntax may be a bit off. :)



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message