Duplicates Finder (Java)
Last modified: 20 April 2023The Duplicates Finder (Java) Build Runner is intended for catching similar code fragments and providing a report on discovered repetitive blocks of Java code. This runner is based on IntelliJ IDEA capabilities, thus an IntelliJ IDEA project file (.ipr) or directory (.idea) is required to configure the runner. The Duplicates Finder (Java) can also find Java duplicates in projects being built by Maven2.
note
In order to run inspections for your project you should have either an IntelliJ IDEA project file (.ipr)/project directory (.idea), or Maven2 pom.xml of your project checked into your version control.
In this section:
IntelliJ IDEA Project Settings
Option | Description |
---|---|
Project file type | To be able to run IntelliJ IDEA duplicates finder engine, TeamCity requires either IntelliJ IDEA project file/directory, or Maven2 pom.xml to be specified here. |
Path to the project | Depending on what type of project you have selected in the Project file type, specify here:
|
Detect global libraries and module-based JDK in the *.iml files | In IntelliJ IDEA module settings are stored in *.iml files, thus if this option is checked, all the module files will be automatically scanned for references to the global libraries and module JDKs when saved. This helps you ensure all references will be properly resolved.
|
Check/Reparse Project | Click this button to reparse your Maven2/IntelliJ IDEA project and import build settings right from the project, for example the list of JDKs.
|
Working directory | Enter a path to a build working directory, if it differs from the build checkout directory. Optional, specify if differs from the checkout directory. |
Unresolved Project Modules and Path Variables
This section is displayed, when an IntelliJ IDEA module file (.iml) referenced from IPR-file:
cannot be found
allows you to enter the values of path variables used in the IPR-file.
To refresh values in this section click Check/Reparse Project.
Option | Description |
---|---|
<path_variable_name> | This field appears, if the project file contains path macros, defined in the Path Variables dialog of IntelliJ IDEA's Settings dialog. In the Set value to field, specify a path to project resources, to be used on different build agents. |
Project JDKs
This section provides the list of JDKs detected in the project.
Option | Description |
---|---|
JDK Home | Use this field to specify JDK home for the project.
|
JDK Jar File Patterns | Click this link to open a text area, where you can define templates for the jar files of the project JDK. Use Ant rules to define the jar file patterns. The default value is used for Linux and Windows operating systems: For Mac OS X, use the following lines: |
IDEA Home | If your project uses the IDEA JDK, specify the location of IDEA home directory |
IDEA Jar Files Patterns | Click this link to open a text area, where you can define templates for the jar files of the IDEA JDK. |
note
You can use references to external properties when defining the values, like
%\system.idea_home%
or%\env.JDK_1_3%
. This will add a Agent Requirements for the corresponding property.
Java Parameters
Option | Description |
---|---|
JDK home path | Use this field to specify the path to your custom JDK which should be used to run the build. If the field is left blank, the path to JDK Home is read either from the |
JVM command line parameters | Specify the desired Java Virtual Machine parameters, such as maximum heap size or parameters that enable remote debugging. These settings are passed to the JVM used to run your build. Example: |
Duplicate Finder Settings
tip
If you need to restrict the sources scope on which to run the Duplicates runner, you can specify additional JVM parameters (in the JVM command line parameters field).
Example:
-Didea.exclude.patterns=testData/**;testdata/**;help/**;test/**;maverick/**;src/tips/**;[testData]/** -Didea.include.patterns=testData/tables/**
all patters must end with either ** or *
includes have precedence over excludes
references to modules can be included as [module_name]/<path_within_module>
tip
For the file paths to be reported correctly, "References to resources outside project/module file directory" option for the project and all modules should be set to "Relative" in IDEA project.
Thanks for your feedback!