where does scm plugin store the crendentials - maven-2

<project>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>a</groupId>
<artifactId>a</artifactId>
<name>SCM Sample Project</name>
<url>http://somecompany.com</url>
<scm>
<connection>scm:svn:http://my-svn-url/trunk/</connection>
<developerConnection>scm:svn:http://my-svn-url/trunk/</developerConnection>
<url>scm:svn:http://my-svn-url/trunk/</url>
</scm>
<build>
</build>
</project>
As you can see I have no svn crendentials I am still able to checkout project.
More of I think maven stores all these credentials somewhere in cache as it is NOT taking my basic configurations as "checkoutDirectory". Can anybody please help on how to clean cache ...or I am missin something :(

The settings.xml file is the correct location for username/passwords:
<server>
<id>my-svn-url</id>
<username>TheUserIAmOnSVN</username>
<password>MySVNPassword</password>
</server>
Special things for Subversion you can configure into the scm provider.
If you are working locally Subversion stores username/passwords in it's own cache ($HOME/.svn/)...

Related

Deploying maven liferay project to remote Jboss based Liferay portal

I'm new with Liferay portal.
here is my config
--Liferay 6.1 deployed on JBoss AS 7.1.1 Final
--Maven 3.1.1
I can easily deploy my portlet(maven project) in local Liferay instance
but i'm trying to deploy this portlet to a remote instance
here is a part of my pom.xml
<properties>
<liferay.version>6.1.2</liferay.version>
<liferay.parent.server>C:\DEV\Env\JBoss</liferay.parent.server>
<liferay.auto.deploy.dir>${liferay.parent.server}\deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\standalone\deployments</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\modules\com\liferay\portal\main</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>${liferay.parent.server}\jboss-as-7.1.1.Final\standalone\deployments\ROOT.war</liferay.app.server.portal.dir>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>${liferay.version}</version>
<configuration>
<autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
<appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
<appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
<appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
<liferayVersion>${liferay.version}</liferayVersion>
<pluginType>portlet</pluginType>
</configuration>
</plugin>
...
</build>
I would " liferay.parent.server " to target the remote directory something like 192.168.1.2/Env/JBoss
I have been working on for a long time
i will really appreciate your helps
Thank you
You need to install the Remote IDE Connector plugin to the remote instance of Liferay portal.
There are both CE version and EE version
Now you can deploy it via your Eclipse: tutorial
Or you can use Jenkins plugin, but be aware this issue (you need to download the source, fix it, and build it)
I remember that Liferay not support remote connector for JBoss.You can see this documents regard enter link description here Maven plugin for JBoss.
Sure, you can do remote deploy by maven plugin. You can read this guide http://www.dontesta.it/blog/en/blog-2/cms/liferay/liferay-maven-come-fare-il-deploy-remoto-dei-plugin/
In this article we will see a possible solution for remotely deploying the artifact of a Liferay project based on the maven
The plugin maven wagon-maven-plugin (or wagon) is what will allow you copy the WAR of our portlet on the remote server and then the hot deployment of Liferay (of which I recommend reading the hot deployment versus auto deploy) will carry out the actual installation. Listing 1 shows the wagon plugin configuration included within the plugins section of our project pom.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<fromDir>${project.build.directory}/</fromDir>
<includes>*.war</includes>
<url>scp://${jboss.deploy.username}:${jboss.deploy.password}#${jboss.deploy.hostname}/</url>
<toDir>${jboss.deploy.liferay.dir}</toDir>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

ivy - why is trying to download yyyy.bundle and can I avoid that?

We recently transformed a maven pom to ivy but are getting this error for many things(not all things):
[NOT FOUND ] org.apache.geronimo.specs#geronimo-javamail_1.4_spec;1.7.1!geronimo-javamail_1.4_spec.bundle (11649ms)
The only difference between the pom files that work and don't is there a package element with the value "bundle".
Maven is working fine. How can we get ivy working as it gets the pom and just really needed to download the jar artifact.
More info, I changed my ivysettings so it ends in .jar instead of [ext] like so
This workardoun worked but I am worried now source downloads won't work anymore. Unfortunately, I don't control the poms in the repository that specify bundle in the packaging attribute. Is there a way to override certain things in ivy so I can fix all these and not use my temporary workaround?
I copied from the pom in nexus for that url which is the following and notice packaging is bundle
<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>
<parent>
<groupId>org.apache.geronimo.genesis</groupId>
<artifactId>genesis-java5-flava</artifactId>
<version>2.0</version>
</parent>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<packaging>bundle</packaging>
<name>JavaMail 1.4</name>
<version>1.7.1</version>
<description>Javamail 1.4 Specification</description>
<url>
http://geronimo.apache.org/maven/${siteId}/${version}
</url>
<distributionManagement>
<site>
<id>apache-website</id>
<url>${site.deploy.url}/maven/${siteId}/${version}</url>
</site>
</distributionManagement>
The pom that brings that in is cxf-bundle which I depend on. The dependency in the cxf-bundle is
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<version>1.7.1</version>
<scope>compile</scope>
</dependency>
thanks,
Dean
Darnit, I copied the example on the ivy site which downloads an older version that has this bug
https://issues.apache.org/jira/browse/IVY-899
The newest version works just fine.

Maven: Using inherited property in dependency classifier causes build failure

Given three POM files:
C depends on B.
B inherits from A.
I can build A and B
C fails to build because of its dependency on B.
The full source-code and build output is included below for your review.
Here is A's 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>A</name>
<repositories>
<repository>
<id>foo releases</id>
<name>libs-releases-local</name>
<layout>default</layout>
<url>http://foo.net/artifactory/libs-releases-local</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>swt</artifactId>
<classifier>${swt.classifier}</classifier>
<version>3.6.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>windows-x86</id>
<properties>
<swt.classifier>win32-x86</swt.classifier>
</properties>
</profile>
</profiles>
</project>
Here is B's 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.foo</groupId>
<artifactId>A</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../A</relativePath>
</parent>
<artifactId>B</artifactId>
<packaging>jar</packaging>
<name>B</name>
<profiles>
<profile>
<id>windows-x86</id>
<properties>
<swt.classifier>win32-x86</swt.classifier>
</properties>
</profile>
</profiles>
</project>
Here is C's 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>C</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>C</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>B</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Here is the build output from C:
------------------------------------------------------------------------
Building C
task-segment: [install]
------------------------------------------------------------------------
[compiler:compile]
Nothing to compile - all classes are up to date
Downloading: http://foo.net/artifactory/libs-releases-local/org/eclipse/swt/swt/3.6.1/swt-3.6.1-${swt.classifier}.jar
[WARNING] Unable to get resource 'org.eclipse.swt:swt:jar:${swt.classifier}:3.6.1' from repository foo releases (http://foo.net/artifactory/libs-releases-local): Error transferring file: foo.net
Downloading: http://repo1.maven.org/maven2/org/eclipse/swt/swt/3.6.1/swt-3.6.1-${swt.classifier}.jar
Unable to find resource 'org.eclipse.swt:swt:jar:${swt.classifier}:3.6.1' in repository central (http://repo1.maven.org/maven2)
------------------------------------------------------------------------
[ERROR]BUILD ERROR
------------------------------------------------------------------------
Failed to resolve artifact.
Missing:
----------
1) org.eclipse.swt:swt:jar:${swt.classifier}:3.6.1
I know this issue is related to https://issues.apache.org/jira/browse/MNG-3228 but I'm not sure how to fix it. Please help!
UPDATE:
Adding a classifier to B helped. Now C builds so long as the repository only contains B's jar file. If I upload B's POM file alongside the JAR in the repository, C fails with the aforementioned error (${swt.classifier} not defined). Any ideas?
In a comment you write, "I am expecting SWT's classifier to get resolved at B's build-time, not C's build-time", but that is wrong - you need the classifier at C's build time because C has a dependency on swt (transitive via A). That dependency is only fully-determined by a property, so you have to have a way of evaluating the property in C's pom.
A depends on swt-${classifier}
C depends on A
therefore C depends on swt-${classifier}
therefore C's pom must define the property. It can be defined by a profile (as in A), or manually at runtime (bad for reproducibility), but you can't build C without it.
It's as simple (and puzzling) as that.
If you're expecting the property to somehow get fully "resolved" along the way, and be already well-defined by the time you build C, you are not understanding how Maven treats those properties. It leaves them alone. There was an attempt to do some different stuff in Maven 2.1 (the classifier property expression would be transformed to its value when you installed A), but it was not successful, caused many surprising behaviours, it was reverted for 2.2, and in fact caused 2.1 to be quickly deprecated. For more details, and some hints as to how complicated the problem really is, see the link below.
https://cwiki.apache.org/confluence/display/MAVENOLD/Artifact-Coordinate+Expression+Transformation
Until the Maven developers decide otherwise, I think we will continue to have the behaviour that has been around since 2.0: "Expressions in artifact coordinates are ignored. Users have plenty of rope with which to hang themselves"
Once you get used to it, though, it's not confusing anymore. It's only when you're trying to second-guess Maven that you get surprised.
Maven is trying to find the artifact org.eclipse.swt:swt:3.6.1 but the coordinates aren't being resolved correctly. The error is saying that ${swt.classifier} isn't being recognized from a <properties/> block in your POM.xml. Since that value shows up in a <profile/> block, can you verify what Maven command you are running?
Try this: mvn dependency:resolve -P windows-x86
Also, verify that both the version of SWT and the Classifier are actually correct. The latest version I see on Maven Central is not 3.6.0, but 3.3.0-v3346
This isn't possible as of Maven 3.1.0. Here is the relevant feature request: https://issues.apache.org/jira/browse/MNG-1388
I know this issue is related to https://issues.apache.org/jira/browse/MNG-3228 but I'm not sure how to fix it.
I'm not sure there is a link with this issue, I don't see anything related to profile activation in the pom.xml shown above.
Actually, I'm not even sure to understand the expected result. From where is the classifier supposed to come? Maybe I'm missing some parts but I think you should install/deploy a qualified version of B (with a fully resolved POM) and have C depend on this qualified version.
How would I need to modify B's POM to deploy a qualified version? I am expecting SWT's classifier to get resolved at B's build-time, not C's build-time.
Yes but at C's build-time, C needs B and B's dependencies so the installed/deployed .pom of B has to be fully resolved. At least, that's how I think things can work.
But I must admit I'm not sure how to handle this case exactly and after reading issues like MNG-4140 or the Artifact-Coordinate Expression Transformation page, I'm totally confused.
I suggest to post this on the maven users list for the right way (and I'll follow the thread closely because I think I have some broken POMs using profiles, properties and dependencies to fix now, thanks :)

Maven Plugin error

Im a new user in maven. I have few doubts.
I have some BAT files that has to executed via maven
While executing my default commands, I need to echo the status like "Started first task"
When the task gets failed user should get error message popup etc.,
Automatic repository update through maven
Maven calling ant to build *.war
Copying the new created build file(*.war) to local folder with date/time
Auto upload/deploy from build machine to server
Testing particular URLs/products to test the site flow
Sending mail regarding deployment status
Below is my example pom.xml, which trying only (a)
<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.example.maven</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<!--echo>Starting CVS Update</echo-->
<configuration>
<tasks>
<exec>
<directory>D:\</directory>
<executable>"D:\test.bat"</executable>
<!--failonerror="true" -->
<!-- optional -->
<!--workingDirectory>"cd C:\repo\projects\mcsandbox"</workingDirectory-->
</exec>
</tasks>
</configuration>
</plugin>
</plugins>
</build>
</project>
I guess this is not the expected answer but I don't think that you're on the right path and I don't see the point of using Maven the way you'd like to use it. From your description, my impression is that you aren't really adopting Maven but rather trying to insert something existing into it and, believe me, this isn't the easiest way to get started with Maven:
This is going to add an extra layer of complexity.
This requires a deeper understanding of the way maven works than "just" adopting it.
You're going to fight against the tool (and there are good chances that the tool will win).
This will generate more troubles than benefits.
I don't really know where to start so I'll just try to quickly cover your points first:
I have some BAT files that has to executed via maven
This is possible but this is not really the Maven way (depending on the logic, you should move it to Maven or keep it outside maven), and I don't think this is going to be very robust (might be wrong though). On top of that, this already requires some knowledge of the build lifecycle (where to hook things) and of plugin configuration. And from what I've seen (I do not mean to be rude), you don't have it.
While executing my default commands, I need to echo the status like "Started first task"
This is not how things work with Maven. Maven isn't procedural like Ant, Maven has conventions, Maven is declarative, Maven has a lifecycle.
When the task gets failed user should get error message popup etc.,
User? Popup? Maven is not really targeted at end users, Maven is a developer tool and what you get in case of an error is a message in a console.
Automatic repository update through maven
Do you mean a CVS update? This is not impossible but is usually not Maven's job (it's more a Continuous Integration engine task).
Maven calling ant to build *.war
This is possible using the Maven Antrun Plugin but that's not the spirit and may go against some maven rules (like one artifact per project). Also, Maven will not magically be aware of things built by Ant. Why don't you just stick with Ant?
Copying the new created build file(*.war) to local folder with date/time
Possible. But that's not how things work by default.
Auto upload/deploy from build machine to server
Maven has plugins (e.g. Cargo) that can help at doing this but you have to tell him to.
Testing particular URLs/products to test the site flow
Maven itself won't do that. But it can run (integration) tests doing that.
Sending mail regarding deployment status
That's not maven's responsibility (more a Continuous Integration engine task).
My global feeling is that you are thinking too much Ant oriented and maybe expecting too much from Maven. Maven is different, it doesn't really work the way you described, it doesn't work like Ant. My recommendation would be to either fully migrate to Maven and adopt its philosophy or to stick with your current Ant solution (and maybe consider using the Maven Ant Tasks or Ivy to leverage things such as dependency management, artifact deployment).
See also
How to convert from Ant to Maven (...)
Differences between Ant and Maven
Maven: The Definitive Guide

Maven server authentication as profile properties

I am trying to setup a shared authentication system on a build server.
We have several maven projects that declares how the deployment should be done regarding the different teams that we have (each team has its own authentication user/password):
<profile>
<id>release-profile</id>
<distributionManagement>
<repository>
<id>rep-releases</id>
<name>rep-releases</name>
<url>http://somewhere-releases</url>
</repository>
<snapshotRepository>
<id>rep-snapshots</id>
<name>rep-snapshots</name>
<url>http://somewhere-snapshots</url>
</snapshotRepository>
</distributionManagement>
</profile>
Then I declare in the settings.xml the authentification to the declared servers as following:
<servers>
<server>
<id>rep-releases</id>
<username>${release.user.name}</username>
<password>${release.user.password}</password>
</server>
<server>
<id>rep-snapshots</id>
<username>${release.user.name}</username>
<password>${release.user.password}</password>
</server>
</servers>
Finally, depending on the projects I want to deploy I have several profiles defined in the settings.xml of the build server:
<profile>
<id>dep-team1</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<release.user.name>team1-user</release.user.name>
<release.user.password>team1-password</release.user.password>
</properties>
</profile>
The problem is that when doing a deploy of the project I got an authentication error (HTTP 401) like the following:
Error deploying artifact: Failed to transfer file: http://......./my-project-0.2-20090423.123247-3.pom. Return code is: 401
If I modify the server authentication by replacing the properties with the user/password of the team, all is working fine.
Don't the tags <servers><server> accept values as properties?
How do others setup their build system in order to achieve the same?
Thanks for your help.
Edit: I am using hudson, a solution for me can be to install several time maven2 and have duplicated settings (except user/password) for each team and tie each project to the good maven installation. I must admit that this solution does not enchant me...
The easiest and most direct method if you have multiple teams and thus multiple auth schemes, is just use a different id in the distributionManagement. So instead of rep-releases/rep-snapshots, you can have team1-repo / team2-repo (there's generally no value in separating the auth between release and snapshots...particularly if you use a repo manager with good security controls)
Then in the settings of your build machine, just define a user and password for each team for the build server.
This approach does have a draw back that it would mess up inheritence if you defined the repos in a single corporate pom...but if you have a team level pom it would be easy.
Another thought is why does the same build machine need to login as a different person when doing builds? Shouldn't that build machine have mostly full access?
First of all, I do not see how dep-team1 profile is connected to the distributionManagement tag - it seems to need release-profile to be active.
Second, I have my profile element structured a bit differently (see, there is no distributionManagement tag within). Not sure if it makes the difference.:
<profile>
<id>release-profile</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
Here is the distribution management:
<project>
<distributionManagement>
<repository>
<id>releases</id>
<url>http://myurl/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<url>http://myurl/snapshots</url>
</snapshotRepository>
</distributionManagement>
</project>