Build dependency issue with Grails and Maven - grails

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.

Related

POM Error while importing spring boot maven project into STS

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>

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>

Vaadin + maven problems

I'm trying to setup Vaadin for a new project.
I'm following the steps documented in https://vaadin.com/wiki/-/wiki/Main/Creating+a+Maven+project
The following command in empty directory:
mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.1.8
Gives me a following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.2:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.vaadin:vaadin-archetype-application:7.1.8) -> [Help 1]
I've also tried creating pom with:
<?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>group</groupId>
<artifactId>artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>name</name>
<description>description</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<vaadin.version>7.1.6</vaadin.version>
</properties>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiled</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
</dependencies>
</project>
Running mvm clean install results in the following error:
[ERROR] Failed to execute goal on project artifact: Could not resolve dependencies for project group:artifact:war:1.0-SNAPSHOT: The following artifacts could not be resolved: com.vaadin:vaadin-server:jar:7.1.6, com.vaadin:vaadin-client-compiled:jar:7.1.6, com.vaadin:vaadin-client:jar:7.1.6, com.vaadin:vaadin-themes:jar:7.1.6: Failure to find com.vaadin:vaadin-server:jar:7.1.6 in http://10.255.251.14:9991/nexus/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
Also there are the following warnings seen:
[WARNING] The POM for com.vaadin:vaadin-server:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client-compiled:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-client:jar:7.1.6 is missing, no dependency information available
[WARNING] The POM for com.vaadin:vaadin-themes:jar:7.1.6 is missing, no dependency information available
At first we thought there might be some problems with our nexus installation, but we also tried running these commands from external machine without nexus. Same issues.
Try to add
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
Add this to your pom.xml:
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>vaadin-snapshots</id>
<url>http://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Then you have to force the update. Example: mvn install -U
It seems that the problem is related to maven repositories and not vaadin.
I've tried locating computer in other country (most likely different maven repository mirror too) and it worked.
Update: I had it working for an hour or so without changing anything and then it started failing again.
This might be related to the heartbleed bug everyone is going crazy about at the moment. Admins probably patching it all over the place and there might be some disruptions to repository services or our own network.
Looks like the list of available archetypes isn't up to date.
Run this command mvn archetype:update-local-catalog

Sonar and MAVEN POM file with Dependencies

I have setup Maven and Sonar to analyze .NET projects and it works fine for winforms projects. However when I add an MVC project it gives a build Failure because it can't find the System.Web.MVC.dll file. I have an Fx-Cop plugin that runs as part of Sonar.
One way to get around this would be to package the dll, copy local= true with the project. However I dont want to do that(any thing wrong with packaging the MVC file along?)
How do I add a dependency to the MVC dll? I followed this example and added it like this:
<dependencies>
<dependency>
<groupId>artifact_group_id</groupId>
<artifactId>System.WEb.MVC</artifactId>
<version>4.0.30319</version>
<type>library</type>
<scope>system</scope>
<systemPath>C:\DOTNET\DLLS\System.Web.Mvc.dll</systemPath>
</dependency>
</dependencies>
Still I get a Build Failure caused by FX-Cop. Looking at the FX-Cop logs I get a message as below:
The following error was encountered while reading module 'MyTestMvcApp': Assembly reference cannot be resolved: System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
I'm using apache-maven-3.0.2 and sonar-3.2. Can anyone help with this?
This is the full 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>Test</groupId>
<artifactId>Sonar.For.NET.Test</artifactId>
<version>1.0</version>
<name>Testing </name>
<packaging>netpack</packaging>
<properties>
<visual.studio.solution>TestProjectsForSonarBuild.sln</visual.studio.solution>
<visual.test.project.pattern>*.Tests;*Test</visual.test.project.pattern>
<dotnet.tool.version>4.0</dotnet.tool.version>
<sonar.language>cs</sonar.language>
</properties>
<dependencies>
<dependency>
<groupId>artifact_group_id</groupId>
<artifactId>System.WEb.MVC</artifactId>
<version>4.0.30319</version>
<type>library</type>
<scope>system</scope>
<systemPath>C:\DOTNET\DLLS\System.Web.Mvc.dll</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.sonar-plugins.dotnet</groupId>
<artifactId>maven-dotnet-plugin</artifactId>
<version>0.6</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<configuration>
<toolVersion>3.5</toolVersion>
<buildConfigurations>Debug</buildConfigurations>
<rebuild>true</rebuild>
<language>cs</language>
</configuration>
</plugin>
</plugins>
</build>
</project>
Thanks for your time.
You can use the "sonar.fxcop.assemblyDependencyDirectories" property as described on the documentation page for the FxCop plugin.
So you have 2 solutions from there:
either your build process copies "System.Web.MVC.dll" in a temp folder, which you reference through the this property
or you directly reference an absolute path where this DLL can be found (but your property may then be not portable accros different environments/servers)

Resources