dkpro-jwpl icon indicating copy to clipboard operation
dkpro-jwpl copied to clipboard

Improve PMD analysis on CI server

Open mawiesne opened this issue 6 years ago • 8 comments

Found in the output of the Jenkins builds:

[INFO] --- maven-pmd-plugin:3.9.0:pmd (default) @ de.tudarmstadt.ukp.wikipedia.parser --- [WARNING] This analysis could be faster, please consider using Incremental Analysis: >https://pmd.github.io/pmd-6.0.1/pmd_userdocs_getting_started.html#incremental-analysis

Can you, @reckart, check this and if we can make the analysis faster? It would be helpful to speed the PMD analysis up, as we wouldn't have to wait so long until the CI build reports back to Github.

mawiesne avatar Jul 17 '18 12:07 mawiesne

Puh... I could easily disable PMD for PR builds and just keep it active for master builds.

I know that some tools (I think checkstyle and/or findbugs as well) support incremental modes. What I am not sure is: where to store their data. Normally, the CI build keeps all data in its workspace and to ensure that builds are working on a clean state, the workspace is reset before the build is started. I guess that would wipe out any state that these plugins may keep.

Do you have any experience with using these incremental modes in local builds or in conjunction with a CI server? How do you handle the state?

reckart avatar Jul 17 '18 13:07 reckart

You could configure the pmd maven plugin to use a location such as the target folder at root level of the checkout point.

I tried it once with maven-pmd-plugin:3.9.0 yet it did not work in all cases (e.g, empty sub-modules with no java source files. I think that's not the case for JWPL). Maybe, things improved with version 3.10.0: https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-pmd-plugin/3.10.0.

mawiesne avatar Jul 17 '18 13:07 mawiesne

I could try to check another code base and paste a configuration here, later this week.

mawiesne avatar Jul 17 '18 13:07 mawiesne

@reckart You might try to use a config like this

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-pmd-plugin</artifactId>
	<version>3.10.0</version>
	<configuration>
		<targetJdk>${java.target}</targetJdk>
		<failOnViolation>false</failOnViolation>
		<minimumTokens>100</minimumTokens>
		<analysisCache>true</analysisCache>
		<includeTests>true</includeTests>
		<linkXRef>false</linkXRef>
	</configuration>
	<executions>
		<execution>
			<id>pmd</id>
			<phase>package</phase>
			<goals>
				<goal>check</goal>
				<goal>pmd</goal>
			</goals>
		</execution>
	</executions>
</plugin>

The important part is <analysisCache>true</analysisCache>.

I just tested this with two independent projects. It worked fine.

mawiesne avatar Aug 02 '18 11:08 mawiesne

It should be a quick fix, combined with other maven plugin updates in dkpro-parent pom.

mawiesne avatar Aug 02 '18 11:08 mawiesne

@reckart Do you have some spare time to test the above config via dkpro-parent?

mawiesne avatar Aug 21 '18 13:08 mawiesne

@mawiesne you can just plug it into the JWPL pom for testing, can't you? I don't see why it would be necessary to put it into the parent pom. I have deactivated the pmd profile in the PR builder such that it doesn't run twice.

reckart avatar Aug 21 '18 13:08 reckart

@reckart Ok, i can give it a shot via a separate 190 branch. We can then evaluate the result of the changed configuration via the Jenkins output.

mawiesne avatar Aug 22 '18 09:08 mawiesne