Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

What is the difference between files and fileset option in the clover-setup task?

The <clover-setup> has two similar tags:

  • <files>
  • <fileset>

In both of them we can specify inclusion/exclusion pattern for instrumentation.

What are the differencies?

2 answers

1 accepted

0 votes
Answer accepted

The <files> is an Ant's PatternSet. It means that you do not specify any root directory, but only path fragments for inclusion/exclusion patterns.

The <fileset> is an Ant's DirSet. Therefore it has a "dir" attribute and uses a standard Ant's DirectoryScanner to find sources for inclusion/exclusion.

But there are more differencies.

Because of fact that <fileset> is a DirSet, it is being resolved by Ant at the time when it processes the <clover-setup> task configuration. It means that base directory specified in the "dir" attribute as well as source files to be included/excluded must be present at the time when the <clover-setup> task is called.

It has implication for instance in case when you use Clover and generate sources and want to exclude them. In such case you have to ensure that <clover-setup> is called after source generation (otherwise sources won't be put into Clover's exclusion list).

Alternatively, you could switch to the <files> PatternSet.

Because of fact that <files> is a PatternSet, it is being resolved by Clover at the time when it instrument sources, i.e. at the moment when the <javac> task (intercepted by Clover) is called.

It means that files do not have to be present at the time when <clover-setup> is called in order to be properly included/excluded.

And how paths defined in the <files> PatternSet are matched against sources?

Well, they're being matched against source roots passed to <javac>. So you shall define values of includes/excludes attributes as paths relative to the <javac srcdir="..."> attribute.

0 votes

There is one more difference between the <files> and the <fileset>. First one performs the same pattern matching on all source roots. Second one has the "dir" attribute, which you can use to restrict pattern matching to certain source roots.

 

Imagine a case in which you have "src" and "test" folders, both containing the "com.acme" package (among other packages) and that you want to exclude it from instrumentation.

 

&lt;files&gt;&lt;excludes name="com/acme/**"&gt;&lt;/files&gt;

excludes "com.acme.*" from both the "src" and the "test" folders.

 

&lt;fileset dir="test"&gt;&lt;excludes name="com/acme/**"&gt;&lt;/fileset&gt;

excludes "com.acme.*" from the "test" folder only.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Opsgenie

Investigate deployment-related incidents with Bamboo and Opsgenie together

Back in April of last year one of the major product announcements from Opsgenie was the launch of the Incident investigation view which created a deep connection between Bitbucket and Opsgenie, empow...

110 views 1 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you