Posts Tagged ‘mirror’

Initially Liferay Maven repository must be added so edit you maven settings xml

$ nano ~/.m2/settings.xml

and add the following

<repository>
<id>liferay-ce</id>
<name>Liferay CE</name>
<url>https://repository.liferay.com/nexus/content/groups/liferay-ce/ </url>
</repository>

<pluginRepository>
<id>liferay-plugin</id>
<url>https://repository.liferay.com/nexus/content/groups/liferay-ce/ </url>
</pluginRepository>

Next step is to checkout liferay from liferay git repository.

 

$ git clone https://github.com/liferay/liferay-maven-support
$ cd liferay-maven-support/

List the available tags

$ git tag -l

should produce a list like that

….
6.1.20
6.1.30
6.2.0
6.2.0-b1
6.2.0-b2
6.2.0-ga1

6.2.10.1-ga1

Checkout the version you want

$ git checkout tags/6.2.10.1-ga1

Switch to Tag resources

$ git branch -D master
$ git checkout -b master

Build and install Liferay Maven support version 6.2.10-ga1
either with

$ mvn clean package install

for module supprot or for complete liferay artifact support

$ mvn clean install

at the end of the process you should see something like ,

 

[INFO] ————————————————————————
[INFO] Reactor Summary:
[INFO]
[INFO] Liferay Maven 2 Support ……………………… SUCCESS [ 0.279 s]
[INFO] Liferay Maven 2 Archetypes …………………… SUCCESS [ 0.004 s]
[INFO] Liferay Maven 2 Ext Archetype ………………… SUCCESS [ 1.404 s]
[INFO] Liferay Maven 2 Hook Archetype ……………….. SUCCESS [ 0.326 s]
[INFO] Liferay Maven 2 Layout Template Archetype ……… SUCCESS [ 0.307 s]
[INFO] Liferay Maven 2 Portlet Archetype …………….. SUCCESS [ 0.197 s]
[INFO] Liferay Maven 2 Portlet ICEfaces Archetype …….. SUCCESS [ 0.087 s]
[INFO] Liferay Maven 2 Portlet JSF Archetype …………. SUCCESS [ 0.094 s]
[INFO] Liferay Maven 2 Portlet Liferay Faces Alloy Archetype SUCCESS [ 0.080 s]
[INFO] Liferay Maven 2 Portlet PrimeFaces Archetype …… SUCCESS [ 0.255 s]
[INFO] Liferay Maven 2 Portlet RichFaces Archetype ……. SUCCESS [ 0.064 s]
[INFO] Liferay Maven 2 ServiceBuilder Archetype ………. SUCCESS [ 0.118 s]
[INFO] Liferay Maven 2 Theme Archetype ………………. SUCCESS [ 0.085 s]
[INFO] Liferay Maven 2 Web Archetype ………………… SUCCESS [ 0.379 s]
[INFO] Liferay Maven 2 Plugins ……………………… SUCCESS [ 0.014 s]
[INFO] Liferay Maven 2 Plugin ………………………. SUCCESS [ 3.433 s]
[INFO] ————————————————————————
[INFO] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 8.966 s
[INFO] Finished at: 2014-04-30T10:33:43+02:00
[INFO] Final Memory: 28M/210M

Next we want to keep this versioned since we might wish to make changes to the code or to have build integration with Jeknins and artifactory.
For this reason a liferay svn repository is created, if you want to know more about the configuration you can check my previous post.

$ svnadmin create /usr/local/svn/repos/liferay
$ nano /usr/local/svn/repos/liferay/conf/svnserve.conf

[general]
#anon-access = none
anon-access = read
auth-access = write
password-db = /usr/local/svn/passwd-team
realm = Team
Ctrl-X to save

Then back to the directory you checked out liferay with maven support , checkout your empty repository

$ svn checkout svn://localhost/liferay .

Add all to subversion recursively

$ svn add * –force
$ svn commit ‘Initial Version’

For a  “How-To” Build Integration with Jenkins and Artifactory, you can read my earlier post .

 

Back to Index


References: how-to-configure-liferay-maven-plugin-module-with-liferay-portal-6-2

 

After Jenkins is installed and configured , we need to download and install artifactory plugin for jenkins. This is done by going to Manage Jenkins > Manage Plugins refresh the list of available plugins select the artifactory plugin.

Next go to artifactory plugin configuration ,  Manage Jenkins > selecting artifactory plugin.

Enter the artifactory root url as onfigurged it in the previous post or as you have configured it.

http://localhost:8081/artifactory/

If you not allow anonymous reads make sure you enter username / password so that jenkins will be able to connect

then click save

Now In order to be able to deploy artifacts to artifactory , we need to create user for jenkins.

Admin > Security >Users > Create new User 

Fill in the required fields, for the purpose of this post i created the jenkins user under name “jenkins”

Let the checkboxes as they are by default. After the user is created, we need to give the user deploy permnissions to the selected target repositories

Admin > Security >Users > Permissions

Under permission management we will edit “Anything” permission target or create a new one.

Select the Snapshots and release repositories of the repository you wish to deploy, then go to users tab  and give and check deploy  for user jenkins. Save Changes.

Now we are ready to create a new job under jenkins and deploy to artifactory

New Item > fill the Item name form and select “build maven 2/3 project” click okto go to the project configuration screen.

Under Source Code Management, choose subversion, as configured in  the previous post.

Fill in the svn url for  your project svn://localhost/liferay, and or any credenetials you might have

Next provide a ROOT POM , pom.xml in Build sectrion and under Goals and options type clean install

Note: The ROOT POM should be in the root or a subdirectory of yuor project, and the path will be relative, so if you write just pom.xml means that the pom is in the root directory of your project. Similarly writing “maven/pom.xml”  means that the pom file is in the maven subdirectory of your project root folder.

Once configured , you won’t have to worry for unresolved references in your projects.

Under Build Environment check :  Resolve artifacts from artifactory enter your artifactory url, http://localhost:8081/artifactory/ select a repository from the automatically selected repositories “repo

Finally at Post-Build Actions select , Deploy artifacts to artifactory,check the artifactory url, then select the repositories you gave deploy access to user jenkins we created earlier in this post.

“local-repo-release” and local-repo-snapshot”

At deploy time the target repository will be selected automatically , based on the deployed artifact type.

Check override default deployer credentials as our default user “anonymous” has only read access and  enter “jenkins” credentials.

username: jenkins

password: somepassword

click save .

Next click build now to build the project and jenkins to use artifactory to download the required artifacts and upload your build.

 

Thats IT!

You should now have a fully traceable environment with jenkins, maven and artifactory working with subversion.

Back to Index

 


References: Jfrog tutorials & Screencasts

Artifactory Installation
First of all download Artifactory. Our choice of download is the binary zip version.

Extract Artifactory there , cd $HOME/Apps/ && unzip artifactory-3.2.0.zip 

Ussually is best to keep the original directory name and create a link to it without the version (instead of renaming), this way is easier to be able to switch between versions with minimal changes , ln -s artifactory-3.2.0 artifactory

Then we need to update the  $PATH and create the ARTIFACTORY_HOME as USER variables , we do that by adding at the end of .bashrc  – nano ~/.bashrc the following two lines

ARTIFACTORY_HOME=$HOME/Apps/artifactory
PATH=$PATH:$M2_HOME/bin:$ARTIFACTORY_HOME/bin:
ctrl – x to save .

In order the changes to take effect we need either to close the terminal and reopen it or … to export the variables,

export ARTIFACTORY_HOME=$HOME/Apps/artifactory
export PATH=$PATH:$M2_HOME/bin:$ARTIFACTORY_HOME/bin:

if we want to test that everything is well-configured , echo ARTIFACTORY_HOME should display the absolute path /home/$user/Apps/artifactory.

that’s  in terminal.

after we do that we type cd $HOME/Apps/artifactory && ./artifactory  to verify that everythinbg is correctly installed.  This should start artifactory  with default settings.

After the above command we should see something like ,

###########################################################
### Artifactory successfully started (2.377 seconds)    ###
###########################################################

 

then we go to http://localhost:8081/artifactory/webapp/login.html. Login with default Username admin and password password.
Artifactory Configuration
Once logged In we go to Admin Tab , on the left menu  Proxies -> click New …  and add Proxy key : cache , host : cache , since this is proxy we will use the usual proxy port : 3128 and we will check the set Default

We may also add a password if we wish but security is not the point of this post  ,might be a future one though.

Next we go to Home Tab , on the left menu Maven Settings -> Releases – libs releases , plugin releases – pluging releases, and for snapshots  , the equivalent  ones,  libs snapshots and pluging snapshots.

Following that we check Mirror Any and Repo, Click Generate Settings.

Make sure the Settings contain the following:

<server>
<id>central</id>
<username>admin</username>
<password>password</password>
</server>

Download the generated file and copy it to  ~/.m2/ (file should have the name settings.xml)

 

Back to Index

 


References: Jfrog tutorials & Screencasts

What  we want :

  1. be able to pull/fetch from the upstream repository.
  2. people can clone this local repository and work on their own projects; and then they can push their projects/branches/changes to this local repository (we don’t push back to the upstream repository).
  3. when people pull from this local repository, they should be able to see the changes in the upstream repository.

Todo  this we meed to setup a –mirror of the source repository. This implies –bare. Compared to –bare, –mirror not only maps local branches of the source to local branches of the target, it maps all refs (including remote-tracking branches, notes etc.) and sets up a refspec configuration such that all these refs are overwritten by a git remote update in the target repository.

Command Usage : git clone -v –progress –mirror https://github.com/Liferay-Patchers-Community/liferay-portal.git

followed by git fetch

References : https://www.kernel.org/pub/software/scm/git/docs/git-clone.html