Maven Checkstyle:Check not working
I have been working on trying to get Checkstyle working in Maven in the Eclipse Indigo IDE for a while. Finally, I thought I will ask for some expert advise on this.

I am using Eclipse Indigo and trying to configure Checkstyle to run in Maven.

Below is a snippet of my pom.xml. Only checkstlye:checkstlye is working and creating the reports. 

======

   		<profile>
		    <id>checkstyle-profile</id>
        	<build>
        		<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
						<version>2.9.1</version>
						<configuration>
							<includeTestSourceDirectory>true</includeTestSourceDirectory>
							<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
						</configuration>
						<executions>
							<execution>
								<id>checkstyle-check</id>
								<goals>
									<goal>check</goal>
								</goals>
								<phase>compile</phase>  <!--  Default is "verify" -->
								<configuration>
									<violationSeverity>error</violationSeverity>
									<maxAllowedViolations>7000</maxAllowedViolations>
									<failOnViolation>true</failOnViolation>
									<failsOnError>true</failsOnError>
								</configuration>
							</execution>
						</executions>
					</plugin>	
				</plugins>
			</build>
		</profile>
		
    </profiles>
    
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.9.1</version>
				<configuration>
					<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.3</version>
			</plugin>
		</plugins>
	</reporting>    
</project>
======

**Some of the things that are not working are :**


1. configLocation for a custom checkstlye is being ignored and always default to Sun checkstlye.
2. I am unable to run checkstlye:check. I get below error. What target should I run so that the checkstyle:check runs.
 Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.9.1:check (default-cli) on project zzz-web: You have 5950 Checkstyle violations
3. Is the configuration setting right for failing the build if the number of violations crossess 7000 ? 
4. The Checkstyle report is unable to cross reference the Java code from the report. So for example, if I try to drill down from the package to the Java classes and then click on line number of the violation, it does not take me to the Java file. Maybe I have not configured the jxr plugin correctly. 

Hoping for a quick response.

Thanks in advance.
Varma






Maven Checkstyle:Check not working
===

I have been working on trying to get Checkstyle working in Maven in the Eclipse Indigo IDE for a while. Finally, I thought I will ask for some expert advise on this.

I am using Eclipse Indigo and trying to configure Checkstyle to run in Maven.

Below is a snippet of my pom.xml. Only checkstlye:checkstlye is working and creating the reports. 

======

   		<profile>
		    <id>checkstyle-profile</id>
        	<build>
        		<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
						<version>2.9.1</version>
						<configuration>
							<includeTestSourceDirectory>true</includeTestSourceDirectory>
							<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
						</configuration>
						<executions>
							<execution>
								<id>checkstyle-check</id>
								<goals>
									<goal>check</goal>
								</goals>
								<phase>compile</phase>  <!--  Default is "verify" -->
								<configuration>
									<violationSeverity>error</violationSeverity>
									<maxAllowedViolations>7000</maxAllowedViolations>
									<failOnViolation>true</failOnViolation>
									<failsOnError>true</failsOnError>
								</configuration>
							</execution>
						</executions>
					</plugin>	
				</plugins>
			</build>
		</profile>
		
    </profiles>
    
	<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.9.1</version>
				<configuration>
					<configLocation>${basedir}/src/main/resources/maven_checks.xml</configLocation>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.3</version>
			</plugin>
		</plugins>
	</reporting>    
</project>
======

**Some of the things that are not working are :**


1. configLocation for a custom checkstlye is being ignored and always default to Sun checkstlye.
2. I am unable to run checkstlye:check. I get below error. What target should I run so that the checkstyle:check runs.
 Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.9.1:check (default-cli) on project zzz-web: You have 5950 Checkstyle violations
3. Is the configuration setting right for failing the build if the number of violations crossess 7000 ? 
4. The Checkstyle report is unable to cross reference the Java code from the report. So for example, if I try to drill down from the package to the Java classes and then click on line number of the violation, it does not take me to the Java file. Maybe I have not configured the jxr plugin correctly. 

Hoping for a quick response.

Thanks in advance.
Varma





