checkstyle does not pick up src/test folder - maven-checkstyle-plugin

i added checkstyle in maven build but for some reason it only checks src/main folder and ignores the src/test folder, here is my project structure:
Proj
- Module A
- src
- main
- java
- resources
- test
- java
- resources
- Module B
- src
- main
- java
- resources
- test
- java
- resources
pom.xml
checkstyle.xml
and my pom.xml
<properties>
<checkstyle.version>3.0.0</checkstyle.version>
<checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
<checkstyle.consoleOutput>true</checkstyle.consoleOutput>
<checkstyle.failOnViolation>true</checkstyle.failOnViolation>
<encoding>UTF-8</encoding>
</properties>
<build>
<pluginManagement>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<testSourceDirectories>src/test/java</testSourceDirectories>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>

Set the configuration below the <plugin> tag, like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.27</version>
</dependency>
</dependencies>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>

Related

Unable to import javax.sql.Connection in groovy script and unable to run groovy within Eclipse

How can I import javax.sql.Connection in a Groovy script?
How can I configure m2e to work in eclipse
I have a dependency on a jar file I created which uses classes with javax.sql.Connection
and I can call those classes but if I attempt to directly import as in
import javax.sql.Connection
I get
Groovy:unable to resolve class javax.sql.Connection
I realize that there is a Sql class in groovy but I have a lot classes I could call that require a connection and I can't figure out how to get imports to work.
Although I can create an executable uber jar with the following pom, I can't configure the project in Eclipse to quit complaining. Every "fix" I see on stackoverflow that makes it stop complaining in Eclipse stops it from producing an uber jar.
pom.xml
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.myproject
core-groovy-2
1.0-SNAPSHOT
core-groovy-2
jar
<parent>
<groupId>org.myproject.</groupId>
<artifactId>myproject-pom</artifactId>
<version>22.1.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>org.myproject</groupId>
<artifactId>myproject-core</artifactId>
<version>${org.myproject.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit-platform.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.groovy-wslite</groupId>
<artifactId>groovy-wslite</artifactId>
<version>${groovy-wslite.version}</version>
</dependency>
</dependencies>
<build>
<scriptSourceDirectory>src/main/groovy</scriptSourceDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${groovy.compiler.version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler.plugin.version}</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${groovy.compiler.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>3.0.8-01</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${maven-failsafe-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform-surefire-provider.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>junit5</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<includes>
<include>**/*Test5.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<useFile>false</useFile>
<includes>
<include>**/*Test.java</include>
<include>**/*Spec.java</include>
</includes>
</configuration>
</plugin>
<!-- Maven Assembly Plugin: needed to run the jar through command line -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly.plugin.version}</version>
<configuration>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- MainClass in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<!-- <version>${groovy.compiler.version}</evrsion> -->
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>central</id>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<properties>
<junit-platform-surefire-provider.version>1.3.2</junit-platform-surefire-provider.version>
<junit-platform.version>1.8.2</junit-platform.version>
<maven-failsafe-plugin.version>3.0.0-M4</maven-failsafe-plugin.version>
<hsqldb.version>2.4.0</hsqldb.version>
<spock-core.version>2.2.M1-groovy-4.0</spock-core.version>
<groovy-wslite.version>1.1.3</groovy-wslite.version>
<groovy.version>3.0.8</groovy.version>
<assembly.plugin.version>3.1.0</assembly.plugin.version>
<compiler.plugin.version>3.7.0</compiler.plugin.version>
<groovy.compiler.version>3.7.0</groovy.compiler.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hsqldb.version>2.4.0</hsqldb.version>
<spock-core.version>1.1-groovy-2.4</spock-core.version>
<commons-lang3.version>3.9</commons-lang3.version>
<java.version>14</java.version>
<logback.version>1.2.3</logback.version>
<groovy.version>3.0.10</groovy.version>
<gmavenplus-plugin.version>1.6</gmavenplus-plugin.version>
</properties> </project>
Description Resource Path Location Type Plugin execution not covered by lifecycle
configuration: org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
(execution: default-compile, phase: compile) pom.xml /vinyl line 91
Maven Project Build Lifecycle Mapping Problem

How do I setup android test framework espresso as a maven project with eclipse?

I am aware that, It is strongly instructed to use the espresso framework from Andriod Studio. However, We are using maven project type for Weband API automation. That being said, I am trying to find a way to integrate the espresso test framework as a maven project in eclipse. I have tried the following references which didn't work for me.
https://mvnrepository.com/artifact/com.android.support.test.espresso
Is there any way to achieve this?
Thanks,
Ram
Check out Quality-Tools-for-Android repo which has Maven with Espresso integration.
Just in case the project goes somewhere here is pom.xml file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.octo.android</groupId>
<artifactId>android-sample-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>android-sample-espresso-tests</artifactId>
<packaging>apk</packaging>
<name>android-sample-espresso-tests</name>
<properties>
<build-helper-maven-plugin.version>1.8</build-helper-maven-plugin.version>
</properties>
<repositories>
<!--other repositories if any -->
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>android</groupId>
<artifactId>android</artifactId>
</dependency>
<dependency>
<groupId>android.support</groupId>
<artifactId>compatibility-v4</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.octo.android</groupId>
<artifactId>android-sample</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.octo.android</groupId>
<artifactId>android-sample</artifactId>
<version>${project.version}</version>
<type>apk</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android-espresso</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<extensions>true</extensions>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/annotations/</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>emma</id>
<dependencies>
<dependency>
<groupId>emma</groupId>
<artifactId>emma</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<test>
<coverage>true</coverage>
<createReport>true</createReport>
</test>
</configuration>
<extensions>true</extensions>
<executions>
<execution>
<id>pull-coverage</id>
<phase>post-integration-test</phase>
<goals>
<goal>pull</goal>
</goals>
<configuration>
<pullSource>/data/data/com.octo.android.sample/files/coverage.ec</pullSource>
<pullDestination>${project.basedir}/../android-sample/target/emma/coverage.ec</pullDestination>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>spoon</id>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<testSkip>true</testSkip>
</configuration>
</plugin>
<plugin>
<groupId>com.squareup.spoon</groupId>
<artifactId>spoon-maven-plugin</artifactId>
<version>${spoon.version}</version>
<configuration>
<title>Spoon Sample App</title>
<debug>true</debug>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jacoco</id>
<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<dex>
<!-- Required for EMMA -->
<noLocals>true</noLocals>
</dex>
<test>
<coverage>true</coverage>
<createReport>true</createReport>
</test>
</configuration>
<executions>
<execution>
<id>pull-coverage</id>
<phase>post-integration-test</phase>
<goals>
<goal>pull</goal>
</goals>
<configuration>
<pullSource>/data/data/com.octo.android.sample/files/coverage.ec</pullSource>
<pullDestination>${project.basedir}/../android-sample/target/jacoco-it.exec</pullDestination>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
However as of now Google recommends using Gradle for any task connected with Android development or testing, consider switching to Gradle as the chance you will get community support for Maven + Espresso related questions will be minimal. Check out How to Get Started with Espresso (Android) article for quick ramp on on Espresso with Gradle.

how to solve the dependency missing in eclipse by mvn? [duplicate]

This question already has answers here:
How can I make eclipse make use of packages downloaded by maven?
(2 answers)
Closed 9 years ago.
I get a java servlet project from github, it use mvn to compile ,and use jetty as the servlet container.Since I never used mvn ,so I get much problems/.
question 1:
When I run mvn install , it says "BUILD SUCCESS",but after I import this project into eclipse, many packages imported cannot be resolved by eclipse. Why ?It seems that when I run "mvn install",mvn has downloaded all dependencies for me.
question 2:
How to deploy my project to jetty and then run all jUnit test cases ?
question 3:
when I run "mvn jetty:run",it says:
No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/root/.m2/repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
Google says I should add jetty plugins to mvn configuration .But I am confused about the project.Why doesn't the project developers add this to pom.xml?Or, there exist other solutions?
below is the simple project directory.Project name is http-request.
[root#localhost http-request]# ls
lib pom.xml README.md
[root#localhost http-request]# cd lib
[root#localhost lib]# ls
pom.xml src target
pom.xml under http-request:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kevinsawicki</groupId>
<artifactId>http-request-parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>lib</module>
</modules>
</project>
pom.xml under http-request/lib:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.github.kevinsawicki</groupId>
<artifactId>http-request</artifactId>
<version>5.5-SNAPSHOT</version>
<url>https://github.com/kevinsawicki/http-request</url>
<description>Library for making HTTP requests</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<url>https://github.com/kevinsawicki/http-request/issues</url>
<system>GitHub Issues</system>
</issueManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>8.1.9.v20130131</jetty.version>
</properties>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>https://github.com/kevinsawicki/http-request</url>
<connection>scm:git:git://github.com/kevinsawicki/http-request.git</connection>
<developerConnection>scm:git:git#github.com:kevinsawicki/http-request.git</developerConnection>
</scm>
<developers>
<developer>
<email>kevinsawicki#gmail.com</email>
<name>Kevin Sawicki</name>
<url>https://github.com/kevinsawicki</url>
<id>kevinsawicki</id>
</developer>
</developers>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Require-Bundle />
<Export-Package>!.,com.github.kevinsawicki.http</Export-Package>
<Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.8</version>
<configuration>
<message>Generated site for ${project.name} ${project.version}</message>
<noJekyll>true</noJekyll>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>site</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
<configuration>
<dependencyDetailsEnabled>true</dependencyDetailsEnabled>
<dependencyLocationsEnabled>true</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<!-- Used to test proxy -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
There are several issues raised. Let me divide my answer.
Running builds as root
I highly recommend that you stop running builds as root.
[root#localhost http-request]# ls
lib pom.xml README.md
[root#localhost http-request]# cd lib
[root#localhost lib]# ls
pom.xml src target
This is a dangerous practice. Create a normal user account on your system and use this.
Dependencies missing in Eclipse
I have tested the project you are building and confirmed that it builds as follows:
git clone https://github.com/kevinsawicki/http-request.git
cd http-request
mvn install
You state that it fails when run from within Eclipse? Could this be because you have not installed the Eclipse plugin for Maven? See the following question:
How can I make eclipse make use of packages downloaded by maven?
No plugin found for prefix 'jetty'
This error is being thrown because the build has not been configured to use jetty. You need to read the documentation on how to enable this in your build
http://www.eclipse.org/jetty/documentation/current/maven-and-jetty.html
Your question here:
Google says I should add jetty plugins to mvn configuration .But I am confused about the project.Why doesn't the project developers add this to pom.xml?Or, there exist other solutions?
Needs to be addresses to the developer of the project. The most likely explanation is that he is not using Jetty to test his code. For example in my projects I use a continuous integration server (Jenkins) which automatically builds, deploys and tests code every time a code commit is made.

how to specify path to aop.xml using aspectj maven plugin

Hi My problem is pretty much same as AspectJ Plugin Aspect Config with Maven using external Jar for Aspect
Here is my pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<!-- <configuration> <webXml>target/web.xml</webXml> </configuration> -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<dependencies>
<!-- NB: You must use Maven 2.0.9 or above or these are ignored (see
MNG-2972) -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
<phase>process-sources</phase>
</execution>
</executions>
<configuration>
<outxml>true</outxml>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
<weaveDependencies>
<weaveDependency>
<groupId>${project.groupId}</groupId>
<artifactId>core</artifactId>
</weaveDependency>
<weaveDependency>
<groupId>${project.groupId}</groupId>
<artifactId>core-client</artifactId>
</weaveDependency>
</weaveDependencies>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</build>
I have my aop.xml in META-INF directory as follows:
<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.eclipse.org/aspectj/dtd/aspectj.dtd">
<aspectj>
<!--
We only want to weave in the log4j TimingAspect into the #Profiled classes.
Note that Perf4J provides TimingAspects for the most popular Java logging
frameworks and facades: log4j, java.util.logging, Apache Commons Logging
and SLF4J. The TimingAspect you specify here will depend on which logging
framework you wish to use in your code.
-->
<aspects>
<aspect name="org.perf4j.log4j.aop.TimingAspect"/>
<!-- if SLF4J/logback use org.perf4j.slf4j.aop.TimingAspect instead -->
</aspects>
<weaver options="-verbose -showWeaveInfo">
<!--
Here is where we specify the classes to be woven. You can specify package
names like com.company.project.*
-->
<include within="com.xyz.store.security.*"/>
</weaver>
</aspectj>
What I want to do ultimately is this:
http://perf4j.codehaus.org/devguide.html#Using_the_AspectJ_Compiler_to_Integrate_Timing_Aspects_at_Compile_Time

M2E not adding Groovy source to .classpath on import existing maven project

Using Eclipse Indigo to import existing maven project, the resulting workspace project does not include src/main/groovy or src/test/groovy in the build path. I would also like to have the output dir for the groovy code set to target/test-classes.
This is my first question to this excellent group, so I hope I cover all of the bases.
Environment:
Eclipse Indigo
m2e - Maven Integration for Eclipse 1.2.0.20120903-1050 org.eclipse.m2e.feature.feature.group Eclipse.org - m2e
m2e connector for build-helper-maven-plugin 0.15.0.201207090124 org.sonatype.m2e.buildhelper.feature.feature.group Sonatype, Inc.
APT M2E Connector 0.0.1.3 de.joe.m2e.apt.feature.feature.group null
Groovy-Eclipse Feature 2.5.2.xx-20110929-1800-e37 org.codehaus.groovy.eclipse.feature.feature.group Codehaus.org
Groovy-Eclipse M2E integration 2.7.1.xx-20120921-2000-e37RELEASE org.codehaus.groovy.m2eclipse.feature.group Codehaus.org
Tycho Project Configurators 0.6.0.201207302152 org.sonatype.tycho.m2e.feature.feature.group Sonatype, Inc.
My pom.xml for the project is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.jha.yhs</groupId>
<artifactId>fraud.server.parent</artifactId>
<version>201203.8.0-SNAPSHOT</version>
</parent>
<artifactId>ach-wire</artifactId>
<dependencies>
<dependency>
<groupId>com.jha.yhs</groupId>
<artifactId>aspects</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.jha.yhs</groupId>
<artifactId>database</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r09</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>0.5-groovy-1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.155</version>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
</plugin>
</plugins>
</build>
</project>
Now this pom.xml is a child (in a subdirectory) of another pom.xml which contains:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<compilerVersion>1.6</compilerVersion>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<encoding>windows-1252</encoding>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/groovy</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m -XX:-HeapDumpOnOutOfMemoryError</argLine>
<includes>
<include>**/UnitTests.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.3</version>
<dependencies>
<dependency>
<groupId>org.codehaus.gmaven.runtime</groupId>
<artifactId>gmaven-runtime-1.7</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.7.6</version>
</dependency>
</dependencies>
<configuration>
<providerSelection>1.7</providerSelection>
</configuration>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
please note, I can add the groovy source folders using:
- the GUI's build path
- by editing the .classpath file
- run mvn eclipse:eclipse from the command line and the groovy source dir's get added to .classpath but not the output directories.
However, looking at: this and this using build-helper should solve the problem. I have tried putting the build-helper reference into the project pom.xml with no change in behavior. I have also tried using the maven-eclipse plugin to set the additional source folders as described here and
We have four of these sub projects that use groovy and I would love to not have to add the groovy folders and output folders for main and test for each of them whenever we pull new code from SVN. It seems that M2E's import maven project just doesn't work correctly. Neither does maven->updateProject for that matter. What am I missing from this?
As a work around, it seems that m2e 1.2 does not overwrite the .classpath and .project files like m2e 1.0 liked to do, so I can always manually configure the .classpath and .project files and put them into source control.
I am using Groovy in webapp developing with Maven. But I am using groovy-eclipse-compiler. First, I configure Maven compiler plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${groovy-eclipse-compiler.version}</version>
</dependency>
</dependencies>
</plugin>
Then, I configure source directories:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/groovy</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/groovy</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
After that, I am able to use Groovy with Eclipse + m2e (actually, I am using Springsource Tool Suite with Groovy plugin). I have Groovy syntax and autocompletion (far from ideal), also I can use Groovy classes from Java and vice versa.