Something has gone wrong with my pom and I have a blank dependency and artifactId in the xml but get the same error whether I delete the tags or not.
I am using eclipse with m2eclipse installed in my home folder on Linux Mint 14 with maven version 'Apache Maven 2.2.1 (rdebian-8)' installed
Here is the 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>TransferHandler</groupId>
<artifactId>TransferHandler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.4.6-rc1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.49</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.2</version>
<classifier>ftp</classifier>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<artifactId></artifactId>
</dependency>
</dependencies>
</project>
There are three error messages displayed:
On line1:
Multiple annotations found at this line:
- null (org.apache.maven.plugins:maven-resources-plugin:2.5:resources:default-resources:process-resources)
- null (org.apache.maven.plugins:maven-resources-plugin:2.5:testResources:default-testResources:process-test-
resources)
On line70:
Multiple annotations found at this line:
- Project build error: 'dependencies.dependency.groupId' for null::jar is
missing.
- Project build error: 'dependencies.dependency.version' for null::jar is
missing.
On line 71:
Project build error: 'dependencies.dependency.artifactId' for null::jar is missing.
It seems like the one on line 70 with the empty tags is the root cause (excerpt below) but I'm not sure.
<dependency>
<artifactId></artifactId>
</dependency>
Even if I delete the empty tags from the xml and refresh maven and the project the error remains. On my Dependencies tab I see a jar with a '?' next to it but can't delete it and in my Dependency Hierachy tab I see a ' : [compile]' jar but can delete or exclude it.
How can I remove this ghost/null jar?
Try This Header
<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">
Good Luck !
I found a way around the problem using git but was not able to solve it directly by removing the offending packages.
The work-around was to shutdown eclipse, remove the pom and then use git to discard changes in the working directory. Commands:
rm pom.xml
git checkout -- pom.xml
Then the pom should reappear returned to its state at the last commit (which luckily for me was before this error arose). Not a very satisfying answer but at least it worked. If anyone posts an answer and explanation to the heart of the real problem (ie why can't I remove a null package and how did it get there in the first place) I would still be happy to accept it.
Related
When i exeute:
mvn -Dparam.version=9 help:effective-pom | clip
in the command line on Windows 10 i get all over this clip only:
<properties>
<param.version>4</param.version>
</properties>
which is the old version.
How can i force to change this param?
In the cmd:
mvn --version
Apache Maven 3.5.4
Froms poms:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
EDIT:
I use this property to set depedency version for example:
<dependency>
<groupId>x</groupId>
<artifactId>c-api/artifactId>
<version>${param.version}</version>
</dependency>
inside c-api we can see:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>x</groupId>
<artifactId>c</artifactId>
<version>4</version>
</parent>
<artifactId>c-api</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>x</groupId>
<artifactId>c-api</artifactId>
</dependency>
<dependency>
<groupId>x</groupId>
<artifactId>p-api</artifactId>
</dependency>
<dependency>
<groupId>x</groupId>
<artifactId>f-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
First, you need use -Dparam.version instead -dParam.version.
If
<properties>
<param.version>4</param.version>
</properties
is defined in the xxx.pom file, you are not allowed to change it using command line, while you are free to override it. And in this case, though the value is still 4 in the pom file, others which refer it by ${param.version} will pick 9.
You are looking in the incorrect place when checking if your command line parameter has been correctly applied.
If you entered the command mvn -Dparam.version=9 help:effective-pom then you should see your dependency version evaluated correctly.
Where your pom has
...
<dependency>
<groupId>x</groupId>
<artifactId>c-api</artifactId>
<version>${param.version}</version>
</dependency>
...
the output of the command will display
...
<dependency>
<groupId>x</groupId>
<artifactId>c-api</artifactId>
<version>9</version>
</dependency>
...
If you just run mvn help:effective-pom you will see
...
<dependency>
<groupId>x</groupId>
<artifactId>c-api</artifactId>
<version>4</version>
</dependency>
...
with the version specified in the pom properties displayed instead.
Currently I am moving from karaf 3.0.5 to the newest version 4.0.2, I do assembly my own karaf with the karaf-maven-plugin. This is how my pom looks like.
<?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">
<parent>
<groupId>my.own.group</groupId>
<artifactId>assemble</artifactId>
<version>1.14.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>karaf-customize</artifactId>
<modelVersion>4.0.0</modelVersion>
<packaging>karaf-assembly</packaging>
<dependencies>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>framework</artifactId>
<version>${karaf.version}</version>
<type>kar</type>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>standard</artifactId>
<classifier>features</classifier>
<version>${karaf.version}</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf.karaf</groupId>
<artifactId>apache-cxf</artifactId>
<classifier>features</classifier>
<version>${cxf.version}</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.karaf.features</groupId>
<artifactId>enterprise</artifactId>
<classifier>features</classifier>
<version>${karaf.version}</version>
<type>xml</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>my.own.group</groupId>
<artifactId>kar-archive</artifactId>
<version>1.14.0-SNAPSHOT</version>
<type>pom</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>my.own.group</groupId>
<artifactId>karaf-branding</artifactId>
<version>1.14.0-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.alutam</groupId>
<artifactId>ziputils</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<version>${karaf.version}</version>
<extensions>true</extensions>
<configuration>
<javase>1.8</javase>
<bootFeatures>
<feature>jasypt-encryption</feature>
<feature>config</feature>
<feature>standard</feature>
<feature>region</feature>
<feature>management</feature>
<feature>bundle</feature>
<feature>package</feature>
<feature>kar</feature>
<feature>ssh</feature>
<feature>http</feature>
<feature>cxf</feature>
<feature>service-wrapper</feature>
<feature>jdbc</feature>
<feature>system</feature>
</bootFeatures>
</configuration>
</plugin>
</plugins>
</build>
</project>
With this configuration I do get the following error for several dependencies.
Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1
at org.apache.karaf.features.internal.resolver.ResourceBuilder.doBuild(ResourceBuilder.java:88)
at org.apache.karaf.features.internal.resolver.ResourceBuilder.build(ResourceBuilder.java:78)
I guess it happens within this parser. The reason is some old third party libraries have only Bundle-ManifestVersion: 1 set within their manifest file.
With karaf-maven-plugin 3.x this didn't matter at all. In contrast the karaf-maven-plugin 4.x fails with message above.
The only way I know to fix this is either rebuild from source or repack the hole jar again.
Is there any other way like a configuration for the karaf-maven-plugin to disable this constraint check? Because it would be awful lot of work to get all of this bundles up an running, again.
I faced the same error when updating to Karaf 4 and you have two choices:
Osgify conflictive dependency using bndtools:
Download bnd tools
Open a shell where you have downloaded bnd-2.4.0.jar.
Type:
java -jar bnd-2.4.0.jar wrap -o osgify-dependency.jar dependency.jar
where dependency.jar is your third party and osgify-dependency.jar will be the output.
Deploy to maven repo overriding the previous maven coordinates, or deploy your thirdparty with different coordinates.
mvn deploy:deploy-file -Dfile osgify-dependency.jar ..
Enable the wrap protocol
Add to you maven karaf plugin wrap and wrapper features.
So you can use wrap protocol to fix your corrupted MANIFEST.MF
Inside some karaf features:
<bundle>wrap:mvn:group.id/third.party.artefact.id/version</bundle>
Inside your pom.xml notice feature wrap / wrapper.
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
</executions>
<configuration>
<!-- no startupFeatures -->
<bootFeatures>
<feature>feature</feature>
<feature>jaas</feature>
<feature>shell</feature>
<feature>ssh</feature>
<feature>management</feature>
<feature>bundle</feature>
<feature>config</feature>
<feature>deployer</feature>
<feature>diagnostic</feature>
<feature>instance</feature>
<feature>kar</feature>
<feature>log</feature>
<feature>package</feature>
<feature>service</feature>
<feature>system</feature>
<feature>wrap</feature>
<feature>aries-blueprint</feature>
</bootFeatures>
<installedFeatures>
..
<feature>wrapper</feature>
</installedFeatures>
</configuration>
</plugin>
Here you have the full code where i tested:
https://github.com/antoniomaria/gazpachoquest/blob/master/karaf-assembly/pom.xml
i followed this spring-mvc-tutorial using eclipse, but after i call Maven / Update Projects my WEB-INF/lib directory remains empty.
this is how my project explorer looks:
i also see no mistake in my Deployment Assembly settings:
this is the pom.xml file i use:
<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>CrunchifySpringMVCTutorial</groupId>
<artifactId>CrunchifySpringMVCTutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
i even switched to a new workspace as suggested in this link, but nothing helped
EDIT:
when i start the server i get the error:
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
Eclipse virtually hides the files from the view that displays the WEB-INF/lib folder in a Maven-managed Dynamic Web-Project project. As your first screenshot indicates, the "Maven Dependencies" library entry has been successfully added to your classpath in the background by Eclipse - it contains every dependency referenced in your pom.xml.
The intention behind this behavior for that is/might be: You - as a developer - are not supposed to copy any .jar files manually to WEB-INF/lib, cause that way you would kind of cheat around the idea behind a (Maven-) managed project.
In a certain way, this makes sense as Maven performs any dependency management for you and thus resolves and "bundles" any third-party (or your own) artifacts.
If you run a mvn with the goals clean package (or even: clean install) it will produce a .war file for you in the "target" folder of your project. If you extract that .war file you should find a WEB-INF/lib folder that contains all dependencies bundled into your deployable artifact.
I think it is correct.
Libraries are copied into target after build, not into project itself.
Also Step 8 in the tutorial you pasted shows the same (empty lib folder)
I'm using Jenkins to run some testNG test, when the build is finished i get the following message at the end:
[INFO] Build failures were ignored.
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/test-output/testng-result.xml
Did not find any matching files.
Finished: SUCCESS
I looked at the workspace in Jenkins and there is no folder named test-output, the question here is, how do I tell jenkins to create the folder with the results in there?
Here is my pom.xml if needed:
<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.barco.automation</groupId>
<artifactId>barcoAutomation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>barcoAutomation</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<!-- added -->
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.42.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
<build>
<finalName>My Automated tests</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
Thanks
you need to add post-build action in jenkins to add relative path of the testng-result.xml which can be found in your workspace.
I will recommend you to use HTML Report Publisher Plugin in Jenkins addon and configure your reports as below. This will allow you to view the report for every build. Through this you will be able to archive all your testNG reports build wise and it can be seen on the Job level as well. Once you are installing this plugin, configure your job and add a POST-BUILD-STEP (to enable the HTML REPORT PUBLISHER) and follow the location setting for testNG reports. Please refer to the screenshot below and let me know in case of any questions. Hope this helps!
Typically, your TestNG reports generated here :
<Jenkins-Location>\jobs\<JOB_NAME>\workspace\target\html
Im trying to compile this project h__p://ross-warren.co.uk/my-twitter-clone-using-jsp-and-cassandra/
I have downloaded it, and spend almost one day searching for all dependency jar files and still I was not able to run that project. When I did some search I have discover maven. So I've downloaded it, in eclipse I click convert to maven or something, I've added some dependecy records to pom.xml and I still Im not able to run the project. There are some errors in jsp files. These errors werent there befoe.
for example in file LogChech.jsp
<jsp:useBean id="User"
class="uk.co.ross_warren.litter.stores.UserStore"
scope="session"
></jsp:useBean>
I have error Undefined type: UserStore.
I dont know where is the problem but I think there is somethign wrong with packages, becase before project conversion I had all java files in packages (at least eclipse showed package icon) and now there is only normal folder icons and folder tree structure with all java files however the first line in java files is package something which is fine I think.
thank you for your help
EDIT
this is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Cinnamon</groupId>
<artifactId>Cinnamon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>me.prettyprint</groupId>
<artifactId>hector-core</artifactId>
<version>1.0-4</version>
</dependency>
</dependencies>
<packaging>war</packaging>
</project>
This is the first image how it looked like before maven conversion
http://oi39.tinypic.com/2q84o5z.
And this is how it looks like now
http://oi44.tinypic.com/14nmgyf.
ok stack overflow says I cant submit images, so please take that url and add jpg extension to see image
The standard maven directory layout expects java sources to be in src/main/java and web resources in src/main/webapp. So your java sources directly in src weren't even compiled. These directories can be configured in the build section of your pom.xml. To set the directory for web resources you also have to configure the maven-war-plugin.
Edit: It seems you were also missing some dependencies, the pom below compiles without errors on the command line. I'm not an eclipse user myself but this should work in eclipse too.
<?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>Cinnamon</groupId>
<artifactId>Cinnamon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<directory>build</directory>
<sourceDirectory>src</sourceDirectory>
<outputDirectory>build/classes</outputDirectory>
<!-- not used in your project -->
<testSourceDirectory>srcTest</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>me.prettyprint</groupId>
<artifactId>hector-core</artifactId>
<version>1.0-4</version>
</dependency>
<dependency>
<groupId>org.expressme</groupId>
<artifactId>JOpenId</artifactId>
<version>1.08</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
</project>