[ 
https://issues.apache.org/jira/browse/FLINK-1827?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15283180#comment-15283180
 ] 

josh gruenberg commented on FLINK-1827:
---------------------------------------

Hi all,

This change just tripped up my team: we have some tests that depend on 
flink-test-utils, and we're working with 1.1-SNAPSHOT to try out the 
SessionWindows feature. Our build suddenly stopped working last week when this 
change was deployed, until rmetzger helped us get unstuck (thanks! :) by adding 
the "test-jar" type to the pom dependency.

I'll offer that I think this may not ultimately be a great technique for 
achieving your goal of streamlining your dev-builds. Here's why:

- specifying "<type>test-jar</type>" is error-prone boilerplate for all 
consumers of this dependency; forgetting to include this unusual requirement 
leads to confusing error-messages
- problems arise with transitive dependencies when depending on test-jars: the 
transitive dependencies do not get propagated to the consuming projects, 
requiring all consumers to add direct references to all dependencies 
themselves. This problem can snowball later if more dependencies are added to 
the test-jar. (See https://issues.apache.org/jira/browse/MNG-1378)

I don't think it's correct to assume that all "test-related" code should always 
be in src/test: the purpose of this particular artifact is just to provide 
test-utilities; that is its only reason for existing, and so that code should 
be its src/main. If there were tests FOR the test-utils, then _those_ would 
appropriately reside in src/test (and would thus correctly be omitted from the 
assembly of the released jar).

There's more on this here: 
https://maven.apache.org/plugins/maven-jar-plugin/examples/create-test-jar.html

If your intent is to omit this artifact from a streamlined build, then this 
might be better approached via alternative maven configurations. There are 
probably many ways to achieve this; one possibility is via a profile in the 
flink-test-utils pom that disables its build (eg, by disabling the compiler 
plugin, as described in the second answer here: 
http://stackoverflow.com/questions/14614446/how-do-i-disable-the-maven-compiler-plugin).


> Move test classes in test folders and fix scope of test dependencies
> --------------------------------------------------------------------
>
>                 Key: FLINK-1827
>                 URL: https://issues.apache.org/jira/browse/FLINK-1827
>             Project: Flink
>          Issue Type: Improvement
>          Components: Build System
>    Affects Versions: 0.9
>            Reporter: Flavio Pompermaier
>            Priority: Minor
>              Labels: test-compile
>             Fix For: 1.1.0
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Right now it is not possible to avoid compilation of test classes 
> (-Dmaven.test.skip=true) because some project (e.g. flink-test-utils) 
> requires test classes in non-test sources (e.g. 
> scalatest_${scala.binary.version})
> Test classes should be moved to src/main/test (if Java) and src/test/scala 
> (if scala) and use scope=test for test dependencies



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to