Maven artifacts could not be resolved - maven-2

I added the spring and jboss repositories to my pom.xml like below:
<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">
<name>MyProject</name>
<url>http://www.myproject.com</url>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>myproject</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.3-b02</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.3_01</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.0.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.0-alpha-1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<!-- SPRING DEPENDENCIES -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<!-- HIBERNATE DEPENDENCIES -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.4-Final</version>
</dependency>
<!-- PRIMEFACES -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.0.M4</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>aristo</artifactId>
<version>1.0.1</version>
</dependency>
<!-- OTHER DEPENDENCIES -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.authorize</groupId>
<artifactId>java-anet-sdk</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>com.ocpsoft</groupId>
<artifactId>prettyfaces-jsf2</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans.hint.j2eeVersion>1.6</netbeans.hint.j2eeVersion>
<netbeans.hint.deploy.server>gfv3ee6</netbeans.hint.deploy.server>
</properties>
<repositories>
<repository>
<id>jsf20</id>
<name>Repository for library Library[jsf20]</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
<layout>default</layout>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
<layout>default</layout>
</repository>
<repository>
<id>spring-release</id>
<name>Spring Release Repository</name>
<url>http://maven.springframework.org/release</url>
<layout>default</layout>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
<!--pluginRepositories>
<pluginRepository>
<id>caucho</id>
<name>Caucho</name>
<url>http://caucho.com/m2</url>
</pluginRepository>
</pluginRepositories-->
</project>
But when I build, I get an error:
The following artifacts could not be resolved: org.springframework:spring:jar:3.0.6.RELEASE, org.hibernate:hibernate:jar:3.5.4-Final: Could not find artifact org.springframework:spring:jar:3.0.6.RELEASE in jsf20 (http://download.java.net/maven/2/) -> [Help 1]
It's like maven only looks at the first repository and not the ones defined for spring and hibernate.
Update: Ran with -X and -e options at command line but not very useful from what I can tell: http://pastebin.com/c7nPzBc2

That error just says it cant be found at the java.net repo, it should continue on and check the others until it finds one that does have it. You should be able to safely ignore that.
Also, the url you have listed for spring appears to be dead, it gives me error 500 when i try to go there directly. Either way, its unnecessary as the spring artifacts can be found in maven central (at least through 3.0.6 which you are listing as your dependency).
After a little more investigation, i find that spring has not published a spring artifact since 2.5.6. You will need to specify each artifact individually. For example:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
</dependency>
...

Related

Liquibase hibernate annotation warning when running diff maven goal

I am using liquibase with hibernate to generate diff based on JPA entities. However when I run diff maven goal I get the following warning: Namespace of the [javax.xml.bind.annotation.XmlSchema] annotation does not match [http://www.hibernate.org/xsd/orm/hbm]. Processing bindings will probably fail.
How can I fix this?
pom.xml
<?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>dev.cvetan</groupId>
<artifactId>bezglavi</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
<maven.compiler.release>14</maven.compiler.release>
</properties>
<dependencies>
<!-- spring dependencies -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.7.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>5.2.7.RELEASE</version>
</dependency>
<!-- jpa dependencies -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.18.Final</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.14</version>
</dependency>
<!-- web dependencies - needed for spring-webmvc -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
</dependency>
<!-- needed for rest api -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<!-- mapstruct -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.3.1.Final</version>
</dependency>
<!-- testing dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<release>${maven.compiler.release}</release>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.3.1.Final</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<propertyFile>src/main/resources/liquibase.properties</propertyFile>
<changeLogFile>src/main/resources/db/changelog-master.xml</changeLogFile>
<diffChangeLogFile>src/main/resources/db/changelog/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
<logging>info</logging>
</configuration>
<dependencies>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate5</artifactId>
<version>3.10.1</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.27.0-GA</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

Deploy to weblogic without Artifactory

Is there a way to deploy a war file to Weblogic via maven without sending a version to Artifactory?
Here is my pom.xml file:
<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>...</groupId>
<artifactId>...</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>... Maven Webapp</name>
<repositories>
<repository>
<id>...</id>
<name>...</name>
<url>...</url>
</repository>
</repositories>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>${project.basedir}/src</sourceDirectory>
<outputDirectory>${project.basedir}/target/classes</outputDirectory>
<resources>
<resource>
<targetPath>content</targetPath>
<directory>WEB-INF</directory>
<includes>
<include>Language-ext.properties</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webXml>${project.basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.4</version>
<configuration>
<adminurl>${wls.admin.url}</adminurl>
<user>${wls.admin.username}</user>
<password>${wls.admin.password}</password>
<upload>true</upload>
<stage>true</stage>
<action>deploy</action>
<verbose>true</verbose>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<name>${project.build.finalName}</name>
<targets>${deploy.targets}</targets>
<usenonexclusivelock>true</usenonexclusivelock>
<artifactLocation>
C:\temp\portlet.war
</artifactLocation>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>jsr250-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>8.2</version>
</dependency>
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>10.0.51</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>br.com.gvt.portlets</groupId>
<artifactId>BasePortlet</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>wl-local</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<wls.admin.url>t3://...</wls.admin.url>
<wls.admin.username>...</wls.admin.username>
<wls.admin.password>...</wls.admin.password>
<deploy.remote>true</deploy.remote>
<deploy.targets>...</deploy.targets>
</properties>
<pluginRepositories>
<pluginRepository>
<id>...</id>
<name>...</name>
<url>...</url>
</pluginRepository>
</pluginRepositories>
</profile>
<profile>
<id>wl-remote</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<wls.admin.url>${adminurl}</wls.admin.url>
<wls.admin.username>${user}</wls.admin.username>
<wls.admin.password>${password}</wls.admin.password>
<deploy.remote>true</deploy.remote>
<deploy.targets>${targets}</deploy.targets>
</properties>
</profile>
</profiles>
<distributionManagement>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>corp1</id>
<name>Corporate Repository</name>
<url>file:C:/temp/</url>
<layout>default</layout>
</repository>
</distributionManagement>
</project>
With this configuration when I use mvn deploy it saves a lot of files including the war file in C:\temp
Use the WebLogic Development Maven Plug-In. The wls-maven-plugin "provides enhanced functionality to install, start and stop servers, create domains, execute WLST scripts, and compile and deploy applications".
https://docs.oracle.com/cd/E24329_01/web.1211/e24368/maven.htm#WLPRG591
We've solved the issue, I can deploy to weblogic with eclipse Run as maven build...
On the Goals attribute I put:
wls:undeploy -DmiddlewareHome=C:\Oracle\Middleware\Oracle_Home -DweblogicHome=C:\Oracle\Middleware\Oracle_Home\wlserver -Dadminurl=t3://host:7000 -Duser=user -Dpassword=password -Dtargets=targets -Dname=nameofproject -Dremote=false -Dupload=true wls:redeploy -DmiddlewareHome=C:\Oracle\Middleware\Oracle_Home -DweblogicHome=C:\Oracle\Middleware\Oracle_Home\wlserver -Dadminurl=t3://host:7000 -Duser=user -Dpassword=password -Dtargets=targets -Dname=nameofproject -Dremote=false -Dupload=true
and using a settings.xml file on the User settings field like this:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-releases</name>
<url>http://host:8081/artifactory/libs-releases</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshots</name>
<url>http://host:8081/artifactory/libs-snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-releases</name>
<url>http://host:8081/artifactory/plugins-releases</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>http://host:8081/artifactory/plugins-snapshots</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
<pluginGroups>
<pluginGroup>com.oracle.weblogic</pluginGroup>
</pluginGroups>
</settings>
It lasts some time to undeploy and deploy the war file, but it's better than doing manually.
Thank you all.

Compile JasperReports jrxml with scriptlet dependency in same project via Maven

I have a report project that gets compiled, packaged, and included in a war. I use the jasperreports-maven-plugin to compile the JasperReports templates in the report project. I have an issue with a circular dependency where one of the templates requires a scriptlet class in the same project, but the scriptlet class does not get compiled before the reports and I get a ClassNotFound exception during compilation. Is there a way to compile the class first before the templates or some other workaround besides declaring a system dependency to a previously compiled version of the jar?
Here is my pom:
<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>
<artifactId>report</artifactId>
<name>report</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<configuration>
<artifactItems>
<artifactItem>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
<artifactItem>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<type>jar</type>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${project.build.directory}/generated-jasper</outputDirectory>
<sourceDirectory>src/main/resources/com/example/report/</sourceDirectory>
<compiler>net.sf.jasperreports.compilers.JRGroovyCompiler</compiler>
</configuration>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<!-- use this if you have a report dependency at compile time -->
<!--
<dependency>
<groupId>com.example.usedforcompilingjasperreports</groupId>
<artifactId>compilejasperreports</artifactId>
<scope>system</scope>
<version>0.0.1</version>
<systemPath>${basedir}/src/main/resources/com/example/report/lib/report-${version}.jar</systemPath>
</dependency>
-->
</dependencies>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<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>
jasperreports-maven-plugin
</artifactId>
<versionRange>
[1.0-beta-2,)
</versionRange>
<goals>
<goal>compile-reports</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.0.6.RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>persistence</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ar.com.fdvs</groupId>
<artifactId>DynamicJasper</artifactId>
<version>3.1.9</version>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>2.1.7</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<!-- not used but necessary to avoid an unexpected compiletion exception
An exception has occurred in the compiler (1.6.0_04). Please file a bug at
the Java Developer Connection (http://java.sun.com/webapps/bugreport) after
checking the Bug Parade for duplicates. Include your program and the following
diagnostic in your report. Thank you. com.sun.tools.javac.code.Symbol$CompletionFailure:
class file for javax.persistence.CascadeType not found -->
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.1.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.12</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.15</version>
</dependency>
<dependency>
<groupId>com.force.api</groupId>
<artifactId>force-wsc</artifactId>
<version>22.0.0</version>
</dependency>
<dependency>
<groupId>com.sforce.soap</groupId>
<artifactId>salesforce-webservices</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<parent>
<groupId>com.example</groupId>
<artifactId>assemble</artifactId>
<version>2.2.0-SNAPSHOT</version>
<relativePath>../assemble/pom.xml</relativePath>
</parent>
</project>
Thank you,
Tom
This might be a tad late, but I think you could try to bind the execution of the jasperreports-maven-plugin to a later maven build phase.
By default it runs at the generate-resources phase, at which time the java classes have not yet been compiled.
Check out the paragraph below the code box on this page.

Maven build not running

i have created a maven build of my project.The build was succesfull.But when i deploy it on server (apache tomcat 6) it gives various errors regarding jar files.But those jar files are available on the class path.But when i keep those jar files in the lib directory of server then that error gets resolved.So,anyone having any idea regarding this..I have done anything wrong in building using maven.
My pom.xml
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
Test1
Test1
0.0.1-SNAPSHOT
war
Test1
http://maven.apache.org
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Maven Repository Switchboard</name>
<layout>default</layout>
<url>http://repo1.maven.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-core</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
<dependency>
<groupId>org.ow2.orchestra.eclipse.birt</groupId>
<artifactId>org.ow2.orchestra.eclipse.birt.core</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.ow2.orchestra.eclipse.birt</groupId>
<artifactId>org.ow2.orchestra.eclipse.birt.report.engine</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>openforecast</groupId>
<artifactId>openforecast</artifactId>
<version>1.0.16</version>
<scope>system</scope>
<systemPath>D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>net.sf.jsci</groupId>
<artifactId>jsci</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-taglib</artifactId>
<version>1.3.10</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>struts</groupId>
<artifactId>struts-bean</artifactId>
<version>1.2.7</version>
<type>tld</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<properties>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
</properties>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
</plugins>
</build>
You don't deploy a jar on a Tomcat : you deploy a war file.
The war contains a WEB-INF/lib folder which contains your libraries.
The lib folder at the Tomcat root is used only for libraries shared between all deployed applications. For example, the database driver.
Check that your Maven dependencies are not in scope provided.
They should be included in your WEB-INF/lib folder.
First things like your dependency to the servlet api:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
Must have a scope "provided" like this which means they will be needed for compiling but in the runtime it will be provided by Tomcat in this case.
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
The following:
openforecast
openforecast
1.0.16
system
D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar
indicates you are not using a Repository which is a real must. Never use system scoped dependencies in your build, cause they will make you build environment specific.
Start using a repository manager (Nexus, Artifactory or Archive) and install the openforecast there.
And it's bad practice to define repositories in your pom and in particular Maven Central like you did.
If you have defined the following in your pom as you have:
<properties>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
The configuration of the maven-compiler-plugin is not needed like this, cause the encoding parameter uses as default the above property.
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<properties>
<maven.compiler.target>1.6</maven.compiler.target>
<maven.compiler.source>1.6</maven.compiler.source>
</properties>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
you can use the following:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
But you must define the version of your used plugins:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
The best to do is using a pluginManagement section.
One other thing which comes to my mind is that your are using an old maven-war-plugin and you are using absolute paths in your configuration which you should avoid under any circumstances.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
The up-to-date version is 2.2 as the web-site says. If you need to exclude things like this you should do it in the following way:
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<packagingExcludes>${basedir}/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
But in this case i don't understand why you like to exclude the web.xml, cause it's an essential part of a war file. May be you can elaborate that a little bit more.

Problem creating jar through maven

HI,
I am trying to creating executable jar using maven. The jar is created and when i try to execute java -jar myjar i get the following error
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.conf.Configuration
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
I extracted the jar and see that hadoop classes are not present. And in the logs i could see that hadoop jars are not copied .where is the problem
My pom.xml is as follows :
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.MyClass</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Compile time dependencies -->
<dependency>
<groupId>bixo</groupId>
<artifactId>bixo-core</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-core</artifactId>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-11-jdbc</artifactId>
<version>0.0.4</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.7</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parsers</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.archive</groupId>
<artifactId>heritrix</artifactId>
<version>1.14.3</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>args4j</artifactId>
<version>2.0.10</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>jetty</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>jetty-util</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-mapred</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>0.21.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- Eclipse project generation dependencies -->
<dependency>
<groupId>ant-eclipse</groupId>
<artifactId>ant-eclipse-jvm1.2</artifactId>
<version>1.0</version>
<scope>eclipse</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-core</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>cascading</groupId>
<artifactId>cascading-test</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</dependencyManagement>
`
You've specified the hadoop jars as dependencies with a scope of <scope>provided</scope>.
This implies that they will be on the classpath at runtime, if you want them to be included in your jar, then remove the scope tags and accept the default scope of compile.
see http://maven.apache.org/pom.html