POM Error while importing spring boot maven project into STS - maven-3

org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject, org.apache.maven.archiver.MavenArchiveConfiguration)
This error showing in the first line of POM.

try adding this in pom.xml
<properties>
<maven-jar-plugin.version>2.6</maven-jar-plugin.version>
</properties>

Related

Java Maven pom.xml - dependencies issue

I have a J2EE web application setup using maven build based project.
i have pom.xml, where i have dependencies for my application.
Let's say my App only needed example hadoop-common.jar, log4j.jar becuase of pom.xml which downloads its dependencies jar.
Process downloads all jars in to .m2/repository - locally.
When I bundle war the then WEB-INF/lib has many jars along with hadoop-common.jar, log4j.jar.
How do i ensure only hadoop-common.jar, log4j.jar to be included as part of my war not its dependency in the myWebApp.war
<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>it.cvc.pcam_team</groupId>
<artifactId>pcamapplication</artifactId>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>PCAMApp Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>2.4.1</version>
</dependency>
</dependencies>
...
Are these jars added along with the adoop-common? If hadoop-common is dependent on other jars, these may be added transitively. You can exclude specific jars from being included in that way.
https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
Depending on what you're excluding hadoop-common could stop working though, if you exclude something that's needed for it to run.

Test In Progress is Empty in Jenkins

I have Installed Test In Progress Plugin in Jenkins.And I am selecting the show test in progress option. I am Invoking Ant by specifying the build file name .The Job is Executed Successfully but I am unable to see the Test progress report(i.e it is empty).I have tried adding testInProgress-testng-client-0.1.jar to my test classpath but it shows no results.Please help
I had the same issue in Test In Progress Plugin, of an empty Test progress report in jenkins.
Solved it by adding testInProgress-testng-client in Maven POM dependencies:
<dependencies>
...
<dependency>
<groupId>org.imaginea.jenkins.plugins</groupId>
<artifactId>testInProgress-testng-client</artifactId>
<version>0.1</version>
<scope>test</scope>
</dependency>
...
</dependencies>
And then, set the testinprogress listener (in my case for TestNG), under maven surefire/failsafe plugin configuration:
<configuration>
...
<properties>
<property>
<name>listener</name>
<value>org.imaginea.jenkins.plugins.testinprogress.testng.TestNGProgressRunListener</value>
</property>
</properties>
...
</configuration>

Maven to SVN repository

I am trying to connect maven to SVN repository using valid credentials. My pom.xml file is as follows,
<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.maven.myfirstproject</groupId>
<artifactId>myfirstproject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<scm>
<connection>scm:svn:http://d-113017553/svn/PRONTO/trunk/dev</connection>
<developerConnection>scm:svn:http://d-113017553/svn/PRONTO/trunk/dev</developerConnection>
</scm>
<servers>
<id>central</id>
<username>keerthana</username>
<password>keerthana</password>
<url>http://d-113017553/svn/PRONTO/trunk/dev</url>
</servers>
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-scm-plugin</artifactid>
<version>1.8.1</version>
</plugin>
</build>
</project>
When i run it i get the following errors,
**1)coreException : could not calculate build plan: plugin org.apache.maven.plugins:maven-compiler:2.3.2 or one of its dependencies could not be resolved:Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:2.3.2
2)Plugin execution not covered by lifecycle configuration:org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile(execution:default-testCompile,phase:test-compile)**
Would anyone help me out to solve the above errors pls?????
First your pom.xml file can contain the information about VCS but you have to follow the schema for the pom.xml file which can get a good impression about here.
Furthermore it's good practice to indent XML file correctly like this:
<scm>
<connection>scm:svn:http://svn.server.com/svn/my-project/trunk</connection>
<developerConnection>scm:svn:https://svn.server.com/svn/my-project/trunk</developerConnection>
<url>http://svn.server.com/websvn/my-project</url>
</scm>
Apart from the above the things like this:
<servers>
<id>central</id>
<username>keerthana</username>
<password>keerthana</password>
<url>http://d-113017553/svn/PRONTO/trunk/dev</url>
</servers>
do not belong into the pom.xml. They should be put into the setting.xml file in your home folder (usually $HOME/.m2/settings.xml). And of course should you never put credentials into your pom file.

how to copy 3rd party jars in WEB-INF/lib of war

I have created dynamic web project in eclipse.I have developed some code which requires
dependeny jars mentioned in POM as well as some 3rd party jars;so i added all jars in the
build path of the project.these jars are required to compile and run the code when we
deploy in the tomcat.
below pom.xml is used to build the war.I want to include these 3rd party jars in WEB-
INF/lib folder in the war.what changes do i need to make in pom so these jars will come in WEB-INF/lib folder?
Is there any way like whatever jars are added in the project build path does comes in WEB-
INF/lib folder.
or else
put all 3rd party jars in temp folder.then using copy command can we copy these jars from
this temp folder to WEB-INF/lib folder.what is the best approach?
<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.sample</groupId>
<artifactId>SampleWS</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Simple CXF project using spring configuration</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
If you just want to add 3rd party jars in WEB-INF/lib folder, no changes needs to be made to POM.xml. Just do the following Project > Properties > Java Build Path > Libraries > Click on Add JARs....locate JARs in your you project's lib folder.. Now these JARs will be added to war along with those in POM.xml.
P.S: Personally i won't recommend to add jars partially from POM and partially from lib folder.

Build dependency issue with Grails and Maven

I'm trying to integrate Google's JSON RPC library in my Grails project. The Maven configuration is here, I also took the snippet from the site...
<dependencies>
<dependency>
<groupId>org.json.rpc</groupId>
<artifactId>jsonrpc</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>json-rpc</id>
<url>http://json-rpc.googlecode.com/svn/mavenrepo</url>
</repository>
</repositories>
So, I took the above Maven config and placed it in my project's BuildConfig.groovy..
grails.project.dependency.resolution = {
repositories{
mavenRepo "http://json-rpc.googlecode.com/svn/mavenrepo"
}
dependencies {
compile "org.json.rpc:jsonrpc:1.0"
}
}
When I refresh project dependencies, Grails throws this error..
org.json.rpc#jsonrpc;1.0: java.text.ParseException: inconsistent
module descriptor file found in
'http://json-rpc.googlecode.com/svn/mavenrepo/org/json/rpc/jsonrpc/1.0/jsonrpc-1.0.pom':
bad revision: expected='1.0' found='1.0-SNAPSHOT';
I'm not sure if this is a problem with the Google repo or with my config. Based on the error message it appears that Grails was expecting 1.0-SNAPSHOT from the pom, so I change my build file to compile "org.json.rpc:jsonrpc:1.0-SNAPSHOT", but that results in a "module not found" error message.
It looks like the pom file from the repository has issues:
<groupId>org.json.rpc</groupId>
<artifactId>jsonrpc</artifactId>
<name>JSON-RPC</name>
<version>${jsonrpc.version}</version>
<properties>
<jsonrpc.version>1.0-SNAPSHOT</jsonrpc.version>
<java.version>1.5</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
The artifact is version 1.0 but the version from the pom file is defined as 1.0-SNAPSHOT.

Resources