grails is unable to download jar from maven repo - maven-2

I'm trying to do grails clean on my grails project on centoOS server ... It starts downloading dependencies but gets stuck on a particular jar, if I try downloading the jar directly from the browser it working but hangs when I do grails clean
[root]# /root/grails-1.3.4/bin/grails clean
Welcome to Grails 1.3.4 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /root/grails-1.3.4
Base Directory: /root/cooldealsnew
Resolving dependencies...
Dependencies resolved in 1435ms.
Running script /root/grails-1.3.4/scripts/Clean.groovy
Environment set to development
Downloading: http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar ...

maybe you are in a network environment requiring a proxy to access external resources
you can add proxy configurations being used by Grails commands using add-proxy
http://grails.org/doc/latest/ref/Command%20Line/add-proxy.html

Related

Vaadin 7 Portlets error on Glassfish V3

I am creating a Vaadin (version 7) portlet, my development environment is eclipse 4.3.1 + tomcat-7.0.27+Liferay-portal-6.1.1-ce-ga2, I am checking the stuff on tomcat and the portlet runs fine there.
Now my deployment environment is Glassfish-3.1.2+Liferay-portal-6.1.1-ce-ga2, the same portlet and the log message is: "sampleApp was successfully deployed", the Portlet error is "Failed to load the bootstrap javascript: ./../../VAADIN/vaadinBootstrap.js".
Please help me solve this.
From Book of Vaadin:
Liferay 6.1, [...], comes bundled with an older Vaadin 6 version. If you want to use Vaadin 7, you need to remove the bundled version and install the newer one manually as described in this chapter.
In these instructions, we assume that you use Liferay bundled with Apache Tomcat, although you can use almost any other application server with Liferay just as well.
12.5.1. Removing the Bundled Installation
Before installing a new Vaadin version, you need to remove the version bundled with Liferay. You need to remove the Vaadin library JAR from the library directory of the portal and the VAADIN directory from under the root context. For example, with Tomcat, they are usually located as follows:
tomcat-x.x.x/webapps/ROOT/html/VAADIN
tomcat-x.x.x/webapps/ROOT/WEB-INF/lib/vaadin.jar
12.5.2. Installing Vaadin
Get the Vaadin installation package from the Vaadin download page
Extract the following Vaadin JARs from the installation package:
vaadin-server.jar,
vaadin-shared.jar,
as well as the vaadin-shared-deps.jar and jsoup.jar dependencies from the lib folder
Rename the JAR files as they were listed above, without the version number
Put the libraries in tomcat-x.x.x/webapps/ROOT/WEB-INF/lib/
Extract the VAADIN folders from vaadin-server.jar, vaadin-themes.jar, and vaadin-client-compiled.jar and copy their contents to tomcat-x.x.x/webapps/ROOT/html/VAADIN.
$ cd tomcat-x.x.x/webapps/ROOT/html
$ unzip path-to/vaadin-server-7.1.0.jar 'VAADIN/*'
$ unzip path-to/vaadin-themes-7.1.0.jar 'VAADIN/*'
$ unzip path-to/vaadin-client-compiled-7.1.0.jar 'VAADIN/*'
You need to define the widget set, the theme, and the JAR in the portal-ext.properties configuration file for Liferay, as described earlier. The file should normally be placed in the Liferay installation directory. See Liferay documentation for details on the configuration file.
Below is an example of a portal-ext.properties file:
# Path under which the VAADIN directory is located.
# (/html is the default so it is not needed.)
# vaadin.resources.path=/html
# Portal-wide widget set
vaadin.widgetset=com.vaadin.portal.gwt.PortalDefaultWidgetSet
# Theme to use
vaadin.theme=liferay

Intellij IDEA: Server Configuration cannot be run cause file does not yet exist. Use maven goal result as artifact?

until now I deployed to a Glassfish server with the default IntelliJ artifact "Web Application: Archive". Now my built process got a bit more complicated with maven modifying several files.
In the glassfish configuration under Deployment, I substituted the Artifact to deploy with the direct war file and put the maven goal in "Before Launch: Another Configuration"
However, if mvn clean was run the war does not exist and I cannot run the configuration (because the external file doesn't exist).
Can I avoid having to run mvn package once manually? E.g. by making the output of a maven goal an Artifact?
Thanks!

Maven 2 - 'mvn test' does not find internal project plugin dependency

I have a multi-module maven project (maven 2.2.1).
One of the module is a maven plugin.
This plugin is bound to the compile phase of another module, and added as a direct dependency to trigger correct reactor ordering of module's building.
If I run 'mvn clean install' on the root module, with a fresh local repository, everything goes fine (build, test, install). (I precise that my project's artifacts are not deployed anywhere, only installed locally in my machine's local repo).
BUT if I delete my local repository, and perform 'mvn test', the plugin module is reported as missing ? Whereas, the build order is correct, the plugin module is built succesfully before the module using it ???
Is there any special treatment of maven module with 'maven-plugin' packaging ?
I don't understand why other project inter modules dependencies are resolved correctly and not this specific one !
The problem is that a Maven Plugin must be installed into the local repository first before you can use a plugin as a dependency (or better be part of the life-cycle).

Maven: How to install a plugin in offline mode

I'm sitting behind a firewall and therefore maven can't connect to central repositories (error message is given below).
However, I can connect to the internet via HTTP.
How can I install a maven plugin (e. g. archetype) in offline mode (i. e. download some file in a browser and then install the plugin by executing some commands) ?
Thanks in advance
Dmitri
P. S.: Here is the error message:
E:\>mvn archetype:generate -DarchetypeGroupId=com.vaadin
-DarchetypeArtifactId=vaadin-archetype-clean -DarchetypeVersion=LATEST -DgroupI
d=at.swdev -DartifactId=pcc -Dversion=1.0 -Dpackaging=war
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: Connecti
on refused: connect
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jul 22 15:17:00 CEST 2010
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
I'm sitting behind a firewall and therefore maven can't connect to central repositories (error message is given below). However, I can connect to the Internet via HTTP.
Maybe you should clarify a bit because Maven uses HTTP as well. If you connect through some kind of proxy, you CAN configure Maven to do so by declaring the proxy in your ~/.m2/settings.xml. See Configuring a proxy.
How can I install a maven plugin (e. g. archetype) in offline mode (i. e. download some file in a browser and then install the plugin by executing some commands)?
You can install any jar in your local repository using the install:install-file goal (see the Usage page). But this is only a small part of the story, you'll need to install dependencies of the plugin too. And then dependencies of dependencies. This will very quickly become a real nightmare and unmanageable task (that Maven precisely tries to solve). So either:
Configure Maven to access Internet if this is possible ~or~
Setup a corporate repository (like Nexus) on a dedicated machine, see with your admins how to allow it to access Internet) and configure your Maven client to use it ~or~
Copy a "pre-populated" local repository from an existing machine to your machine and run maven offline (with all the limitations this implies) ~or~
Don't use Maven
If you can not use proxy, then you should download all dependencies of plugin as Pascal said. Easiest way to do this.
Download all dependencies using a machine with normal/proxied http connection. Maven dependency plug-in has a goal which can help you. mvn dependency:go-offline
For example I use it to get maven dependencies of app-fuse tutorial.
svn co (http here ) appfuse-demos.googlecode.com/svn/trunk/helloworld
(check out source code)
mvn install (install and see that it works in normal machine)
mvn dependency:go-offline (it downloads everything. Help :tells Maven to resolve everything this project is dependent on (dependencies, plug-ins, reports) in preparation for going offline.)
after that in your local m2 repository (~/m2/repository) , you will find everything you need. Zip that folder. Get it inside your intranet. extract it to your local repository or
corporate repository (nexus, artifactory ..)
you should be able to use that plug-in now.
http://maven.apache.org/plugins/maven-dependency-plugin/
I guess your security firewall doesn't allow you to download from maven central repo.So, you can simply specify mirrors in the settings.xml file in the maven_home. if you have any repository for your company say like nexus, give the server url of that nexus in the mirrors section in your settings.xml.
Note that in case if you don't have any repo for your company you have to download all the dependencies offline and install using mvn install in the local repository in your build server.

Maven downloads corrupted Jars

I am running into a maven problem that's killing all my hairs.
So at the beginning all my maven project works fine. And then when I switched to a new computer today and trying to compile them all.
The first error I see from Eclipse is IO error reading jar files from the local maven repository. Then I googled and someone suggested this is some corrupted files, simply delete them and let maven rebuild the repository.
That solves the problem for a while. And then it keeps popping up again and again.
I got tired and removed the whole local repository and did everything all over again. Then I found out the cause:
The maven remote repository is BAD.
So here is part of the console messages.
[INFO] Unable to find resource 'org.apache.ws.commons.axiom:axiom-dom:jar:1.2.8'
in repository eclipse-repo (http://repo1.maven.org/eclipse)
Downloading: https://maven-repository.dev.java.net/nonav/repository//org.apache.
ws.commons.axiom/jars/axiom-dom-1.2.8.jar
373b downloaded (axiom-dom-1.2.8.jar)
[WARNING] *** CHECKSUM FAILED - Checksum failed on download: local = '2c6102c2c3
70e0b993e897e981618ed448651147'; remote = '
The file contains an http redirect.
301 Moved Permanently
Moved Permanently
The document has moved here.
Apache Server at maven-repository.dev.java.net Port 443
I am stuck. How can I get the real dependency jars? How can I tell maven to avoid this? This is really annoying.
There is king of bug in maven, simply because maven does not skip taking an artifact if one
of the maven repo sends a 301(MOVED PERMANANTLY) and it simply take that message and write it as the pom file. Simply if the maven repo sends 404 it skip that repo and go for another, but here with 301 it just dump the message as the pom file and later on this failes.
I assuming you're using Maven 2.2.1? If yes try, to downgrade to Maven 2.2.0 or use additional setting. In 2.2.1 was change in wagon implementation.
Maven 2.2.1 aims to correct several critical regressions related to the selection of the HttpClient-based Wagon implementation for HTTP/HTTPS transfers in Maven 2.2.0. The new release reverts this selection, reinstating the Sun-based - or lightweight - Wagon implementation as the default for this sort of traffic.
However, Maven 2.2.1 goes a step further to provide a means of selecting which provider - or implementation - the user wishes to use for a particular transfer protocol.
So, try run maven with additional params.
mvn -Dmaven.wagon.provider.http=httpclient clean install
One answer: avoid dev.java.net. It's often broken in one way or the other. If you need things from there, install them in a local repository manager.
I've seen this error with IntelliJ IDEA 13.1.5 and Ubuntu 14.04.
Maven 2.2.? saves the 301 response body as a jar file in the ~/.m2 cache, which causes problems later on during the build.
The fix for me was to install Maven 3. Instructions for Ubuntu 14.04 are here:
http://www.sysads.co.uk/2014/05/install-apache-maven-3-2-1-ubuntu-14-04/