1 2 3 4 5 6 7 8 9 10 |
|
But I wanted to make repository structure as on picture below:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
After some hours with console magic I found solution, and I want to share it.
I decided to modify history to avoid possible merge conflicts. I moved all files in each project to appropriate subfolder (named as project). To do this we needs to export patch and modify it to change pathes.
1 2 3 4 5 6 7 8 9 10 |
|
For each of projects we need to make some steps (enough to change PROJECT
variable)
If you want move projects to named branches instead of multiply default branches you needs prepare following commands which adds branch name information to patch:
1 2 |
|
Now we have patches made from all projects we can combine them. First initialize aggregate repository and import oldest project of all.
1 2 |
|
For other project we need do following steps:
--import-branch
key if you using named branches)This approach illustrated below. If you not using named branches you can use these simple steps:
1 2 3 |
|
If you using named branches your way will more complicated:
1 2 3 4 5 6 7 |
|
I’ve created script which can help to automate first part of this article:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
I’ll glad if this article will useful for someone. Comments are welcome.
]]>Some time ago, I worked on java web project, and I used some JavaScript dependencies for it. I’ve throught about dependency management for javascript dependencies like JQuery. Ordinary JS dependencies is not management, so we need download new versions manually. First I found Bower for javascript dependency management, but I afraid of node.js in dependencies for my project. I thought about CDNs which hosts js libraries. (for example jquery on Google CDN: http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js). I using maven in my projec, so it will be good to use CDNs via maven… Because CDN’s directories stricture is differs from standart maven layout, I decided to write own maven plugin to handle custom repository layout.
When I looked for solution I found that maven allows write plugins which handles custom repository types. But I found too less examples how to do it. I found only one thing: for create custom repository handler we needs to implement RepositoryConnectorFactory interface. I’ve created simple calss to test this approach:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
But this has not worked. To make it work we also need to generate maven component description in META-INF/plexus/components.xml file. To create this file there is plexus-component-metadata plugin, which parses annotations and creates this magic file.
1 2 3 4 5 6 7 8 9 10 11 12 |
|
After components.xml generated and I installed plugin in my local repository all worked fine.
How to use it. First, add my maven repo in your pom.xml (for a while I host it in my own repo, but in future I want to move it to Maven Central):
1 2 3 4 5 6 |
|
Enable plugin in build section of pom.xml:
1 2 3 4 5 6 7 8 9 |
|
Add some repositories, for example:
1 2 3 4 5 |
|
In repository URL we can use following wildcards which will replaced with appropriate values for each artifact:
For parameter which can be empty there is alternate syntax: ${classifier(prefix:.)}
. this syntax is useful for eliminate separators duplicates if value will empty.
After we configured repository we can add some dependencies, for example:
1 2 3 4 5 6 7 8 9 |
|
I’ve used maven-dependency-plugin to copy downloaded libraries to webapp folder:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
That is it. Now we can manage JS dependencies with maven.
Sources can be found here: https://bitbucket.org/eburtsev/maven-custom-repository-layout Plugin can be downloaded from my maven repository: http://maven.burtsev.net/ Sample project uses this plugin https://bitbucket.org/eburtsev/test-javascript-dependencies
]]>The first step is to add the org.springframework:spring-web artifact as project dependency:
1 2 3 4 5 |
|
To make it work you must configure listeners in web.xml, as shown in the following example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
It is also necessary to set custom el-resolver from Spring instead of the standard to allow Spring manage beans. Change faces-config.xml as in following piece of code:
1 2 3 4 5 6 7 8 9 |
|
Now configure spring-context.xml. You just need to set base-package property for context:component-scan:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Now, after we make all necessary settings, we can write some code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
here we using @Controller annotation instead of JSF @ManagedBean and @Scope to set bean scope. List of all possible scopes you can see here: Spring Framework Reference. Also in spring I not found view scope. But I found solution here and here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Run it and follow this link: http://localhost:8080/jsf2-spring-example/index.jsf It’s works! :)
P.S. Full project you can be downloaded from my github repository
]]>I found some repositories with older versions of library.
Also I found awesome script which helps to create local maven repo for Google’s gdata library.
I used modified version of this script to create my own repository hosted on my server. I’ll happy if it will be helpfull for someone.
Details under the cut
How to use:
First connect the repository to your pom.xml
, such as in the example below:
1 2 3 4 5 6 7 |
|
Also you can use mirror on github:
1 2 3 4 5 6 7 |
|
And secondly use the dependencies. For example using of Calendar API v2.0:
1 2 3 4 5 |
|
That’s it:) I hope it is useful to someone:)
P.S. Modified script you can get here
Upd. 2012-04-24: Repository has been updated, added gdata libraries v1.47.0
Upd. 2012-08-14: Repository has been updated, added gdata libraries v1.47.1
Upd. 2012-12-23: Added sources and javadocs jars
1 2 3 4 |
|
But there are an trouble - class org.apache.ibatis.session.SqlSession from MyBatis 3.0.6 does not implement AutoCloseable interface which is required to work try-with-resources construction. I hope that in next version it will be fixed, but now I can offer small workaround.
The first implement a wrapper for SqlSession class implements the interface AutoCloseable:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
|
Also we need write wrapper for SqlSessionFactory class which can work with our custom SqlSession:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
Below I provide iBatis initialization code. It looks as usual, except the line 18, where we initialize our wrapper.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
That’s all - now we can now enjoy java7 features in our project:)
]]>1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
To solve this problem you need to set the poolPingQuery and poolPingEnabled properties in the iBatis config file. For example, see lines 17 and 18 in code below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
|
Probably everyone who started to use the library asked the question “Why components look so huge?”.
To solve this problem, just add following CSS code inside <h:head></h:head>
tag:
1 2 3 4 5 6 |
|
Internet Explorer may incorrectly render pages in which you using PrimeFaces components. To solve this problem is recommended to set the X-UA-Compatible header. In old versions of this library (< 3.0) you can make this by adding meta tag in <h:head></h:head>
tag first. But in newest versions library first renders own code in head tag, and next user code. For solve this in version 3.0 introduced the “first” facet, which renders exactly first in head tag:
1 2 3 4 5 6 7 8 9 |
|
Because this library based on jQueryUI, for create vertical tabs we can use this demo as solution. First add following CSS:
1 2 3 4 5 6 7 8 |
|
And add styleClass property to your tabView:
1
|
|
That’s it ;) This solution based on following questions on StackOverflow: * Make tabs appear vertically on the side when using PrimeFaces TabView * Vertical Tabs with JQuery?
]]>All commands in this guide you need to run with root rights. Let’s go :)
Install Python first time.
apt-get install python
Install python-software-properties - this is best way for adding PPA :)
apt-get install python-software-properties
After installing it you can add PPA by following command. It’s really simple.
add-apt-repository ppa:xxx/yyy
In Lucid Lynx repository mercurial present, but it’s version is too old, so install third-party PPA with newest versions of mercurial:
add-apt-repository ppa:mercurial-ppa/stable-snapshots
apt-get update
apt-get install mercurial
Install nginx from third-party PPA.
add-apt-repository ppa:nginx/stable
apt-get update
apt-get install nginx
Install uwsgi-python as python application server.
add-apt-repository ppa:uwsgi/release
apt-get update
apt-get install uwsgi-python
After software installation go to the next step - configuration. First, review directories structure used in this guide.
/var/www/hosts/hg.server.net/conf здесь будут расположены конфиги
/var/www/hosts/hg.server.net/logs директория для логов
/var/www/hosts/hg.server.net/repos директория, содержащая репозитории
Create UWSGI-application /etc/uwsgi-python/apps-available/hgweb.xml
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Note that in 14-th line you need change path to hgweb config, which we create now.
Create file /var/www/hosts/hg.server.net/conf/hgweb.config
:
1 2 3 4 5 6 7 8 |
|
In last line you need change patchs to repositories dir.
Now we can check how works uwsgi server. For test change line <socket>/var/run/uwsgi.hgweb.sock</socket>
in hgweb.xml file to <socket>127.0.0.1:3031</socket>
and run:
uwsgi-python -x /etc/uwsgi-python/apps-available/hgweb.xml
If all is OK you can go to http://127.0.0.1:3031/
and see repositories list. If it’s true, revert hgweb.xml and make symlink to /etc/uwsgi-python/apps-enabled
:
ln -s /etc/uwsgi-python/apps-{available,enabled}/hgweb.xml
Now we can go to next step.
Create auth file with htpasswd utility
htpasswd -c /var/www/auth/.htpasswd <username>
Create nginx config /etc/nginx/sites-available/hg.server.net
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
Make symlink for config in /etc/nginx/sites-enabled
directory:
ln -s /etc/nginx/sites-{available,enabled}/hg.server.net
Start services:
service uwsgi-python start
service nginx start
Try open http://hg.server.net/
in browser. All is OK if you see list of repositories. If you get an error - check settings.
Next we can add all services to autorun.
First, make symlinks to configs as I write in examples below. Then configure required services for auto start at boot:
update-rc.d uwsgi-python defaults
update-rc.d nginx defaults
That’s it. You can reboot and check how it works.
]]>