Maven is not able to package the aop.xml file when we are using spring-agent.jar file.
We are using Surefire for running unit test cases and jacoco for getting the code coverage.
We are not seeing any issues with spring-agent but aspects are not getting called during run time. We have placed the aop.xml under META-INF folder but it is not getting picked up.
Any idea or pointers on how to make Maven pick up aop.xml file and package it inside the META-INF folder?
this is my pom.xml file
*edit**
this is my pom.xml.. some stuff i removed
<groupId>project-Web</groupId>
<artifactId>project-Web</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>project-Web</name>
<properties>
<hibernate.version>4.2.3.Final</hibernate.version>
<spring.version>3.2.3.RELEASE</spring.version>
<spring.security.version>3.2.1.RELEASE</spring.security.version>
<jersey.version>1.8</jersey.version>
<project.dir>${basedir}</project.dir>
<project.libdir>${project.dir}/lib</project.libdir>
<skipTests>false</skipTests>
</properties>
<repositories>
<repository>
<id>maven-repo</id>
<url>http://maven.apache.org</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-apache-oro</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec-1.3</groupId>
<artifactId>commons-codec-1.3.jar</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${project.libdir}/commons-codec-1.3.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
<version>2.0.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mail</artifactId>
<version>2.0.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.7</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.4</version>
<scope>system</scope>
<systemPath>${project.libdir}/aspectjweaver-1.8.4.jar</systemPath>
</dependency>
<dependency>
<groupId>org.springagent</groupId>
<artifactId>spring-agent</artifactId>
<version>2.5.6</version>
<scope>system</scope>
<systemPath>${project.libdir}/spring-agent-2.5.6.jar</systemPath>
</dependency>
</dependencies>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<env>local</env>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<env>dev</env>
</properties>
</profile>
<profile>
<id>stage</id>
<properties>
<env>stage</env>
</properties>
</profile>
<profile>
<id>lt</id>
<properties>
<env>lt</env>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<env>prod</env>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>generate-resources</id>
<phase>process-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.build.directory}/classes/config</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources/config/${env}</directory>
<includes>
<include>**/*.properties</include>
</includes>
<excludes>
<exclude>${project.basedir}/src/main/resources/config/${env}</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warName>${project.artifactId}-${project.version}</warName>
<webResources>
<resource>
<directory>${project.libdir}</directory>
<targetPath>WEB-INF/lib</targetPath>
<includes>
<include>**/*</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9</version>
<configuration>
<skinnyWars>true</skinnyWars>
<modules>
<webModule>
<groupId>${project.groupId}</groupId>
<artifactId>project-Web</artifactId>
<contextRoot>/dev</contextRoot>
</webModule>
</modules>
</configuration>
<dependencies>
<dependency>
<groupId>comprojectservices</groupId>
<artifactId>project-Web</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>war</type>
<scope>system</scope>
<systemPath>${project.basedir}/target/project-Web-0.0.1-SNAPSHOT.war</systemPath>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4</version>
<configuration>
<forkMode>once</forkMode>
<argLine>
-javaagent:${settings.localRepository}/org/springframework/spring-agent/2.5.6/spring-agent-2.5.6.jar -javaagent:${settings.localRepository}/org/aspectj/aspectjweaver/1.8.4/aspectjweaver-1.8.4.jar
</argLine>
<useSystemClassloader>true</useSystemClassloader>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>test/resources</directory>
<includes>
<include>aop.xml</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
</resources>
</build>
</project>
still aop.xml is not getting picked up, becase aspects are not getting weaved.
i tried all approaches but not getting any clue where i am going wrong.
**BTW :** both the javaagents are in one line only.
does maven-resource-plugin is causing any issue here?
If you just want to package a custom aop.xml that you already have with you (as opposed to generating it through the aspectj-maven-plugin) inside the META-INF, you would only need to tweak the <resources> section of the <build> configuration like this:
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>aop.xml</include> <!-- ensures aop.xml ends inside the META-INF -->
</includes>
<targetPath>META-INF</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>aop.xml</exclude> <!-- ensures all other resources end inside the default target path -->
</excludes>
</resource>
</resources>
...
</build>
This assumes you've placed your aop.xml file under src/main/resources - you can configure this according to your needs.
Here's the minimal configuration you will need to let the aspectj-maven-plugin generate the aop.xml under META-INF to be used for load-time-weaving later. Be sure to include the aspectjrt dependency to your project too.
You can try this on any project - even a barebone Maven project should be enough to test this and verify that the META-INF\aop.xml is created inside your archive. Of course you can tweak the configuration to suit your needs.
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7</version>
<configuration>
<outxml>true</outxml>
<outxmlfile>META-INF/aop.xml</outxmlfile>
<source>1.6</source>
<target>1.6</target>
<complianceLevel>1.6</complianceLevel>
</configuration>
<executions>
<execution>
<id>Generate aop.xml for LTW</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
Related
<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.example.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>0.0.68-SNAPSHOT</version>
<packaging>pom</packaging>
<name>commons-parent</name>
<description>commons-parent</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
</parent>
<modules>
<module>commons-it</module>
<module>commons-client</module>
<module>commons-error</module>
<module>commons-ssm</module>
<module>commons-cache</module>
<module>commons-model</module>
<module>commons-mq</module>
<module>commons-jsonb-gson</module>
<module>commons-util</module>
</modules>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>Nexus</id>
<name>example release repository</name>
<!-- We can not use vc.example.com here because it is not visible for Jenkins running on AWS. -->
<url>nexus url</url>
<layout>default</layout>
</repository>
<snapshotRepository>
<uniqueVersion>false</uniqueVersion>
<id>nexus-snapshots</id>
<name>example snapshot repository</name>
<!-- We can not use vc.example.com here because it is not visible for Jenkins running on AWS. -->
<url>nexus url</url>
<layout>default</layout>
</snapshotRepository>
</distributionManagement>
<!-- FIXME: Update with the correct settings -->
<ciManagement>
<url>ci-url</url>
</ciManagement>
<scm>
<url>https://github.com/example/abc-backend-commons</url>
<connection>scm:git:git://github.com/example/abc-backend-commons.git</connection>
<developerConnection>scm:git:git#github.com:example/abc-backend-commons.git</developerConnection>
<tag>HEAD</tag>
</scm>
<inceptionYear>2017</inceptionYear>
<organization>
<name>example Inc</name>
<url>https://www.example.com/</url>
</organization>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- JMeter properties (defaulted - can be override via command line
args) -->
<host>localhost</host>
<port>8080</port>
<!-- CI settings -->
<ci.build>${BUILD_NUMBER}</ci.build>
<ci.url>${BUILD_URL}</ci.url>
<org.apache.commons.lang3.version>3.4</org.apache.commons.lang3.version>
<org.hibernate.javax.persistence>1.0.0.Final</org.hibernate.javax.persistence>
<org.flywaydb.version>4.2.0</org.flywaydb.version>
<com.github.docker-java.version>3.0.13</com.github.docker-java.version>
<com.amazonaws.version>1.11.225</com.amazonaws.version>
<apache.httpclient.version>4.5.5</apache.httpclient.version>
<spring.framework.version>4.3.10.RELEASE</spring.framework.version>
<gson.version>2.8.4</gson.version>
<spring.jms.version>4.3.10.RELEASE</spring.jms.version>
<apache.activemq.pool.version>5.15.8</apache.activemq.pool.version>
<swagger.annotation.version>1.5.13</swagger.annotation.version>
<javax.validation.version>1.1.0.Final</javax.validation.version>
<postgresql.version>42.2.2</postgresql.version>
<hibernate.version>5.4.23.Final</hibernate.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- Manage local dependencies -->
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-it</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-error</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-ssm</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-cache</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-mq</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-jsonb-gson</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.example.commons</groupId>
<artifactId>commons-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${org.flywaydb.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-s3</artifactId>
<version>${com.amazonaws.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-ssm</artifactId>
<version>${com.amazonaws.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${org.apache.commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>com.github.docker-java</groupId>
<artifactId>docker-java</artifactId>
<version>${com.github.docker-java.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${apache.httpclient.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.framework.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
<version>${spring.jms.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-pool</artifactId>
<version>${apache.activemq.pool.version}</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.annotation.version}</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>${javax.validation.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.3.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>${javadoc.opts}</additionalparam>
</configuration>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- JUnit tests -->
<!-- exclude integration tests from normal build -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/*IT.java</exclude>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*ST.java</exclude>
<exclude>**/*SpecTest.java</exclude>
<exclude>**/*SpecificationTest.java</exclude>
<exclude>**/*Spec.java</exclude>
<exclude>**/*Specification.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<!-- JavaDoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Manifest -->
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<!-- Manifest -->
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addClasspath>false</addClasspath>
<classpathPrefix>lib</classpathPrefix>
</manifest>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${project.version}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- This plug in is needed if jdk 11 is installed to avoid error 'The code being
documented uses modules but the packages defined in
http://docs.oracle.com/javase/8/docs/api/ are in the unnamed module.'-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>8</source>
</configuration>
</plugin>
</plugins>
</build>
<!-- Maven site reports -->
<reporting>
<plugins>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.8</version>
</plugin>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
<!-- To view the maven site, mvn site (-o if too slow), to
deploy to a repo mvn site-deploy, to check all modules locally site:stage -->
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>summary</report>
<report>cim</report>
<report>dependencies</report>
<report>dependency-convergence</report>
<report>dependency-info</report>
<report>dependency-management</report>
<report>distribution-management</report>
<report>issue-tracking</report>
<report>license</report>
<report>mailing-list</report>
<report>project-team</report>
<report>scm</report>
<report>modules</report>
<report>plugins</report>
<report>help</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- When the app runs outside of a CI server then we don't have
access to certain properties, so we just give defaults -->
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>default-property-setter</name>
</property>
</activation>
<!-- default values, please adjust or use the spring Value default -->
<properties>
<ci.build>unknown</ci.build>
<ci.url>unknown</ci.url>
</properties>
</profile>
<profile>
<id>java8-doclint-disabled</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>
</profile>
</profiles>
</project>
getting error(Using java 1.8 to build)
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar (attach-javadocs) on project commons-parent: Execution attach-javadocs of goal org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-javadoc-plugin:2.10.4:jar: java.lang.ExceptionInInitializerError: null
tried many things nothing is working could anyone look and help.
First, try upgrading the maven-javadoc-plugin version.
If that doesn't work...
(1) Make sure the project builds without the maven-javadoc-plugin.
mvn -Dmaven.javadoc.skip=true verify
(2) Disable strict linting.
This is for version 3.0.0+.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>...</version>
<configuration>
<additionalOptions>
<additionalOption>-Xdoclint:none</additionalOption>
</additionalOptions>
</configuration>
</plugin>
If (2) works, then there is most likely a problem with your Javadoc. Is there more to the build logs that may indicate where?
I'm new to this weird Maven thing and unsure how it works. My project contains a valid pom.xml file, but I am unable to do anything with it. Basically, I go to File -> Project Structure -> Libraries -> From Maven... and write pom.xml in this search field, but it does not find anything! I'm pretty sure I am doing something wrong. In general, I just want to know how to download all the libraries into a .jar format.
I use IntelliJand my pom.xml looks like this:
<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.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>ConnectFour</name>
<description>A connectfour website</description>
<inceptionYear>2018</inceptionYear>
<scm>
<url>scm:git:git#github.com:mrniko/netty-socketio.git</url>
<connection>scm:git:git#github.com:mrniko/netty-socketio.git</connection>
<developerConnection>scm:git:git#github.com:mrniko/netty-socketio.git</developerConnection>
<tag>HEAD</tag>
</scm>
<licenses>
<license>
<name>Apache v2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>manual</distribution>
</license>
</licenses>
<developers>
<developer>
<id>mrniko</id>
<name>Nikita Koksharov</name>
<email>abracham.mitchell#gmail.com</email>
<roles>
<role>Architect</role>
<role>Developer</role>
</roles>
<timezone>+4</timezone>
</developer>
</developers>
<distributionManagement>
<repository>
<id>repo1</id>
<name>Release</name>
<url>file://C:/123</url>
</repository>
</distributionManagement>
<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>[2.5,)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>[2.5,)</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>2.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-client</artifactId>
<version>3.4.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-async</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<forceRecheck>true</forceRecheck>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>pmd</goal>
<goal>cpd</goal>
</goals>
</execution>
</executions>
<configuration>
<minimumTokens>100</minimumTokens>
<targetJdk>1.8</targetJdk>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
<configuration>
<consoleOutput>true</consoleOutput>
<enableRSS>false</enableRSS>
<configLocation>/checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<optimize>true</optimize>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<argLine>-Dfile.encoding=utf-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Import-Package>
org.springframework.*;resolution:=optional,com.hazelcast.*;resolution:=optional,org.redisson.*;resolution:=optional,*
</Import-Package>
<Export-Package>
com.corundumstudio.socketio;version="${project.version}",
com.corundumstudio.socketio.annotation;version="${project.version}",
com.corundumstudio.socketio.listener;version="${project.version}",
com.corundumstudio.socketio.protocol;version="${project.version}",
com.corundumstudio.socketio.store;version="${project.version}",
com.corundumstudio.socketio.store.pubsub;version="${project.version}",
</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<basedir>${basedir}</basedir>
<header>${basedir}/header.txt</header>
<quiet>false</quiet>
<failIfMissing>true</failIfMissing>
<aggregate>false</aggregate>
<includes>
<include>src/**</include>
</includes>
<excludes>
<exclude>target/**</exclude>
</excludes>
<useDefaultExcludes>true</useDefaultExcludes>
<mapping>
<java>JAVADOC_STYLE</java>
</mapping>
<strictCheck>true</strictCheck>
<useDefaultMapping>true</useDefaultMapping>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thank you in advance.
There are a number of things that could be going here but try this first:
Try ctrl-shift-a -> "Reimport All Maven Projects"
OR
Views -> Tool Windows -> Maven Projects -> click top left button (looks like a refresh icon)
First of all be sure that your project it is using Maven ?! maybe it is using Gradle so on
For a Maven project, pom.xml file:
For a Gradle project, build.gradle file:
Alternatives to Apache Maven. Jira, Jenkins, Gradle, Apache Ant, and Apache Tomcat
I could not manage to run spring-cloud-contract:generateTests to run without explicitly specifying the goal in maven command line. Here is the plugin configuration of pom.xml:
<!-- Contract Driven Testing -->
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<!-- Don't forget about this value !! -->
<extensions>true</extensions>
<configuration>
<!-- Provide the base class for your auto-generated tests -->
<packageWithBaseClasses>cdc</packageWithBaseClasses>
</configuration>
<executions>
<execution>
<id>spring-cloud-generateTests</id>
<goals>
<goal>generateTests</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-verifier</artifactId>
<version>${spring-cloud-contract.version}</version>
</dependency>
</dependencies>
</plugin>
When I run mvn clean install the tests are not generated, although explicitly specifying the goal fulfills the goal.
Here is the full pom.xml:
<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>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>maliye-muhasebeislemleri</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>maliye-muhasebeislemleri Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Database Dependencies -->
<h2.version>1.4.190</h2.version>
<!-- Testing Dependencies -->
<postgresql.version>9.4.1207</postgresql.version>
<start-class>tr.gov.tubitak.bilgem.yte.maliye.Application</start-class>
<spring-cloud-contract.version>1.0.4.BUILD-SNAPSHOT</spring-cloud-contract.version>
</properties>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Internal Releases</name>
<url>http://yte-nexus:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Internal Releases</name>
<url>http://yte-nexus:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<!-- If you're adding this dependency explicitly you have to add it *BEFORE*
the Release Train BOM -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-dependencies</artifactId>
<version>${spring-cloud-contract.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Testing Dependencies -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-testutils</artifactId>
<version>0.1.6-RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-wiremock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
<scope>test</scope>
</dependency>
<!-- Required by contract tests -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.3.9</version>
<scope>test</scope>
</dependency>
<!-- MGM-CORE Dependencies -->
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-core</artifactId>
<version>0.10.2-RELEASE</version>
</dependency>
<!-- Database Dependencies -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>test</scope>
</dependency>
<!-- POSTGRES -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>maliye-muhasebeislemleri</finalName>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${project.basedir}/target/generated-test-sources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>${spring-loaded.version}</version>
</dependency>
</dependencies>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-automatic-file-creator</artifactId>
<version>0.0.1-RELEASE</version>
<dependencies>
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-automatic-file-creator</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>
</dependencies>
<configuration>
<fName>${packageName}</fName>
<directory>${directory}</directory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-veriaktarim-maven-plugin</artifactId>
<version>0.2.8-SNAPSHOT</version>
<configuration>
<driver>${db.driver}</driver>
<datasetDir>db-changelog/veri/</datasetDir>
<jdbcUrl>${db.url}</jdbcUrl>
<dbUser>${db.username}</dbUser>
<dbPass>${db.password}</dbPass>
<schema>${db.schema}</schema>
<ignoredTables>
<table>databasechangelog</table>
<table>databasechangeloglock</table>
<table>cerceve_hesap_kodu</table>
<table>hesap_grubu</table>
</ignoredTables>
<noTruncateTables>
<table>kamu_idaresi</table>
<table>harcama_birimi</table>
<table>muhasebe_birimi</table>
<table>muhasebe_fisi</table>
<table>ortak_hesap_plani</table>
<table>ortak_hesap_kodu</table>
<table>kurum_hesap_plani</table>
<table>kurum_hesap_kodu</table>
<table>son_fis_bilgisi</table>
<table>harcama_birimi_devir_bilgisi</table>
<table>kurum_hesap_plani_devir_bakiye_bilgisi</table>
<table>kurum_hesap_kodu_devir_bakiye_bilgisi</table>
<table>ortak_hesap_kodu_grubu_kod</table>
<table>ortak_hesap_kodu_grubu</table>
<table>ortak_hesap_kodu_iliskisi</table>
</noTruncateTables>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>cleanAndTransferData</id>
<phase>prepare-package</phase>
<goals>
<goal>cleanAndTransferData</goal>
</goals>
</execution>
<execution>
<id>exportData</id>
<phase>prepare-package</phase>
<goals>
<goal>exportData</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<properties>
<argLine>-Dfile.encoding=UTF-8</argLine>
</properties>
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<changeLogFile>db-changelog/db.changelog-master.xml</changeLogFile>
<driver>${db.driver}</driver>
<url>${db.url}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<defaultSchemaName>${db.schema}</defaultSchemaName>
<contexts>${db.context}</contexts>
<migrationSqlOutputFile>db-setting/muhasebe.sql</migrationSqlOutputFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- JACOCO -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<configuration>
<sourceEncoding>UTF-8</sourceEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
<executions>
<execution>
<id>jacoco-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-prepare-package</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- JACOCO -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.14</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>maliye-kullaniciaktarim-maven-plugin</artifactId>
<version>0.2.2-RELEASE</version>
<configuration>
<securityUrl>${kullaniciAktarim.url}</securityUrl>
<mnemonicCode>MHS</mnemonicCode>
<clientServicePath>${kullaniciAktarim.istemciUrl}</clientServicePath>
<serviceName>muhasebe_islemleri</serviceName>
<userRoleFile>src/main/resources/security/UserRole.xml</userRoleFile>
<rolePermissionFile>src/main/resources/security/RolePermission.xml</rolePermissionFile>
<sqlOutFile>db-setting/kullanici.sql</sqlOutFile>
</configuration>
</plugin>
<!-- Contract Driven Testing -->
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<!-- Don't forget about this value !! -->
<extensions>true</extensions>
<configuration>
<!-- Provide the base class for your auto-generated tests -->
<packageWithBaseClasses>cdc</packageWithBaseClasses>
</configuration>
<executions>
<execution>
<id>spring-cloud-generateTests</id>
<phase>compile</phase>
<goals>
<goal>generateTests</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-verifier</artifactId>
<version>${spring-cloud-contract.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>development</spring.profiles.active>
<build.profile.id>dev</build.profile.id>
<db.url>jdbc:postgresql://localhost:5432/maliye_muhasebeislemleri</db.url>
<db.driver>org.postgresql.Driver</db.driver>
<db.username>maliye_muhasebeislemleri</db.username>
<db.password>Aa123456</db.password>
<db.schema>public</db.schema>
<db.context>development</db.context>
<kullaniciAktarim.url>http://localhost:8080/maliye-kullanici/kullanici/kullanicilariGuncelle</kullaniciAktarim.url>
<kullaniciAktarim.istemciUrl>http://localhost:8080/muhasebe</kullaniciAktarim.istemciUrl>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<spring.profiles.active>test</spring.profiles.active>
<build.profile.id>test</build.profile.id>
<db.url>jdbc:postgresql://mgm-01:5432/maliye?current=maliye_muhasebeislemleri</db.url>
<db.driver>org.postgresql.Driver</db.driver>
<db.username>maliye_muhasebeislemleri</db.username>
<db.password>Aa123456</db.password>
<db.schema>maliye_muhasebeislemleri</db.schema>
<db.context>test</db.context>
<kullaniciAktarim.url>http://mgm-10:8080/maliye-kullanici/kullanici/kullanicilariGuncelle</kullaniciAktarim.url>
<kullaniciAktarim.istemciUrl>http://mgm-09:80/muhasebe</kullaniciAktarim.istemciUrl>
</properties>
</profile>
</profiles>
I tried to run your example but it fails to compile due to missing dependencies. Anyways what #khmarbaise said is perfectly valid. With Maven you have to set a plugin in the <build><plugins> section. If you have it only in the <pluginManagement> section then it won't work. You can check out the Spring Cloud Contract Samples where everything works fine and is well setup - https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/master/producer/pom.xml#L73-L103
I have a pom file with a custom profile like this:
<profile>
<id>openshift</id>
<build>
<finalName>pomtest</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
when I execute
mvn war:war -Popenshift
it correctly generates a ROOT.war in the webapps folder
but when I execute
mvn package -Popenshift
it generates the war file in /home/sas/Ubuntu
(Ubuntu is not a folder, is the name of ht ROOT.war file)
how can I tell package the output location of the package output?
--
edit: I tried with wemu anser with no luck
just in case someone finds it useful, I'm posting the whole pom file here
it's just the pom generated by grails with grails pom-generate xxx
plus the openshift profile
--
<?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>
<groupId>com.pomtest</groupId>
<artifactId>pomtest</artifactId>
<packaging>grails-app</packaging>
<version>0.1</version>
<name>pomtest</name>
<description>pomtest</description>
<properties>
<grails.version>2.1.1</grails.version>
</properties>
<dependencies>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-dependencies</artifactId>
<version>${grails.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.grails</groupId>
<artifactId>grails-plugin-testing</artifactId>
<version>${grails.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>tomcat</artifactId>
<version>${grails.version}</version>
<scope>provided</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>cache</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>resources</artifactId>
<version>1.1.6</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>database-migration</artifactId>
<version>1.1</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>jquery</artifactId>
<version>1.8.0</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>hibernate</artifactId>
<version>2.1.1</version>
<scope>runtime</scope>
<type>zip</type>
</dependency>
</dependencies>
<build>
<!-- trying to set output to webapps/ROOT.war... with no luch so far -->
<directory>${project.basedir}/webapps</directory>
<outputDirectory>${basedir}/webapps</outputDirectory>
<pluginManagement />
<plugins>
<!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>plugins</directory>
<includes>
<include>**/*</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.grails</groupId>
<artifactId>grails-maven-plugin</artifactId>
<version>${grails.version}</version>
<configuration>
<!-- Whether for Fork a JVM to run Grails commands -->
<fork>true</fork>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>grails</id>
<name>grails</name>
<url>http://repo.grails.org/grails/core</url>
</repository>
<repository>
<id>grails-plugins</id>
<name>grails-plugins</name>
<url>http://repo.grails.org/grails/plugins</url>
</repository>
</repositories>
<profiles>
<profile>
<id>tools</id>
<activation>
<property>
<name>java.vendor</name>
<value>Sun Microsystems Inc.</value>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>${java.version}</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>
</dependencies>
</profile>
<profile>
<id>openshift</id>
<build>
<finalName>pomtest</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
--
I think you need to reconfigure the build.directory folder:
<build>
<directory>${project.basedir}/target</directory>
</build>
Note that not all directories can be changed within profiles: http://maven.apache.org/pom.html#Directories
But it may be enough to use available properties or own ones http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide to configure the build to work it the way you want it to.
The default value of warName is already: ${project.build.finalName} - so instead of using pomtest in your example you could use ROOT there as well.
Why stuff ends up in "/home/sas/Ubuntu" at all is hard to tell from the plugin config only.
regards
werner
I have a project that integrates Struts 1 with Spring. I now wish to port it under Maven 2. I have searched for the proper maven archetype but can't seem to find a proper match. Any suggestions?
Thanks!
Thanks Pascal, though I had finally decided to write my own pom.xml which I had initially based on AppFuse (actually can't remember exactly which of their archetypes I had branched off..)
Here it is, hope it helps someone:
(I have removed proprietary dependencies and such, so I hope that it is, in its present form, unbroken...)
<?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>
<groupId>com.foo.bar</groupId>
<artifactId>MyProject</artifactId>
<packaging>war</packaging>
<version>1.0.0.0-SNAPSHOT</version>
<name>My Project</name>
<prerequisites>
<maven>2.0.6</maven>
</prerequisites>
<repositories>
<repository>
<id>codehaus-snapshots</id>
<name>codehaus-snapshots</name>
<url>http://nexus.codehaus.org/snapshots
</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<updatePolicy>always</updatePolicy>
<checksumPolicy>ignore</checksumPolicy>
</snapshots>
</repository>
</repositories>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-idea-plugin</artifactId>
<version>2.1</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<dependenciesAsLibraries>true</dependenciesAsLibraries>
<useFullNames>false</useFullNames>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jspc-maven-plugin</artifactId>
<executions>
<execution>
<id>jspc</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<webXml>${basedir}/target/jspweb.xml</webXml>
<injectString><!-- PrecompiledJSP mapping --></injectString>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.mojo.jspc</groupId>
<artifactId>jspc-compiler-tomcat5</artifactId>
<version>2.0-alpha-3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<webXml>${basedir}/target/jspweb.xml</webXml>
<dependentWarExcludes>**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**</dependentWarExcludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<configuration>
<tasks>
<property name="project.ant.conf"
value="${project.build.sourceDirectory}/../conf" />
<property name="project.ant.resources"
value="${project.build.sourceDirectory}/../resources" />
<property name="project.ant.package"
value="${project.build.sourceDirectory}/../package" />
<property name="project.ant.deploy"
value="${project.build.sourceDirectory}/../../deployment" />
<property name="project.ant.target.deploy" value="${project.build.directory}/deployment" />
<copy todir="${project.ant.target.deploy}">
<fileset dir="${project.ant.deploy}">
<include name="**/*" />
</fileset>
</copy>
<copy todir="${project.ant.target.deploy}/conf">
<fileset dir="${project.ant.conf}">
<include name="**/*.properties" />
</fileset>
</copy>
<copy todir="${project.ant.target.deploy}/resources">
<fileset dir="${project.ant.resources}">
<include name="**/*" />
</fileset>
</copy>
<move
file="${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}"
todir="${project.ant.target.deploy}/webapps" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin><!-- Thanks due to Pascal Thivent # http://stackoverflow.com/users/70604/pascal-thivent -->
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>${basedir}/src/main/package/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>single</goal> <!-- goals == mojos -->
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<!-- Required -->
<path>/MyProject</path>
<warDirectory>${project.build.directory}/${project.build.finalName}</warDirectory>
<!-- Optional -->
<additionalConfigFilesDir>${basedir}/src/main/tomcatconf</additionalConfigFilesDir>
<contextFile>${project.build.directory}/${project.build.finalName}/META-INF/context.xml</contextFile>
<port>${cargo.port}</port>
<systemProperties>
<log4j.configuration>file:${basedir}/src/main/conf/log4j.properties.dev</log4j.configuration>
</systemProperties>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/conf</directory>
<includes>
<include>MessageResources.properties</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp/velocity/templates</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
<testResource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</testResource>
</testResources>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-struts</artifactId>
<version>${spring.struts.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>${org.springframework.spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${taglibs.standard.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>${xalan.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<linkXref>true</linkXref>
<targetJdk>1.6</targetJdk>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<properties>
<!-- Application settings -->
<copyright.year>2010</copyright.year>
<web.framework>spring</web.framework>
<!-- Framework dependency versions -->
<spring.version>2.5.6</spring.version>
<spring.struts.version>2.0.6</spring.struts.version>
<org.springframework.spring.version>2.5</org.springframework.spring.version>
<velocity.version>1.6.2</velocity.version>
<!-- 3rd Party dependency version -->
<log4j.version>1.2.15</log4j.version>
<jstl.version>1.1.2</jstl.version>
<jdom.version>1.1</jdom.version>
<taglibs.standard.version>1.1.2</taglibs.standard.version>
<xalan.version>2.7.1</xalan.version>
<!-- Testing dependency versions -->
<jsp.version>2.0</jsp.version>
<junit.version>4.4</junit.version>
<servlet.version>2.4</servlet.version>
<!-- Cargo settings -->
<cargo.container>tomcat6x</cargo.container>
<cargo.container.home>${env.CATALINA_HOME}</cargo.container.home>
<cargo.container.url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.zip</cargo.container.url>
<cargo.host>localhost</cargo.host>
<cargo.port>8081</cargo.port>
<cargo.wait>false</cargo.wait>
</properties>
</project>
I'm not sure of what you're looking for exactly (after all, a Struts + Spring app is just a webapp) but there is a Struts 1 Blank Archetype for Maven 2:
$ mvn archetype:create \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts-archetype-blank \
-DarchetypeVersion=1.3.5 \
-DgroupId=com.example \
-DpackageName=com.example.projectname \
-DartifactId=my-webapp
I don't think you'll find something for Struts 1 + Spring 2.5 (at least, not to my knowledge).