(This article is still under editing because it's kinda hard to post here this style of docs which is much better to use attachments. Interested guys please leave your comments and contact info, I will send you those attachments.)
Ant + Maven Dependency Management
Ant: http://ant.apache.org/
Release used: 1.7.0Maven dependency management within Ant: http://maven.apache.org/ant-tasks.html
Release used: 2.0.7Build script configuration guide:
Common Ant with Maven
Artifactory (Best internal Maven Repository Management tool):
http://www.jfrog.org/sites/artifactory/latest/Release used: 1.2.5-rc6
Configuration of Artifactory with SQL-Server
How to Deploy Artifact file(s) into Internal Maven Repo under Artifactory
How to Utilize Common Ant With Maven for Easy Ant Build-- To utilize Maven dependency management feature within Ant build process
To take the advantage of Maven dependency library management (focus on your project direct dependencies only, let Maven Dependency Management to manage / download the dependencies of dependencies of dependency for you automatically) without the learning curve and pain of building entire pure Maven build process. And to ease/simplify the ant build script for classpath and get libraries for IDE.
A working copy:
build.xml: |
|
|
The common-maven-in-ant.xml does the dependency magic.
Simple steps to utilize above common scripts:common-maven-in-ant.xml: |
|
1. Create a pom.xml file for your project to define your direct dependencies:
Following are key format & elements of a pom. (a working copy pom.xml)
pom.xml
Note:
- the pom.xml file
must be in the same directory as the build.xml file. - Additional settings in build.xml if
your project used sjs internal dependencies such as, a. sjs-common-util
Make your "post-init" target depends on "compile-common-util". - ...
b. sjs-common-action Make your "post-init" target depends on
"compile-common-action".
...
2. Run ant
build task as usual. e.g.
build task as usual. e.g.
ant jar
One extra
benefit is to get library jars easier by one command:
benefit is to get library jars easier by one command:
ant get-lib-by-maven
Bottom of Form
Artifactory
use Derby as database by default. Syscon has SQL-Server production
database already and the most important is that the backup machenism is
there
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalready.
use Derby as database by default. Syscon has SQL-Server production
database already and the most important is that the backup machenism is
there
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalready.
Quick two
steps to get it work from original zip file:
steps to get it work from original zip file:
1. Replace the
content of repo.xml (inside
webapps\artifactory.war\WEB-INF\lib\artifactory-core-1.2.5-rc6.jar\jcr\repo.xml
inside artifactory-1.2.5-rc6.zip) with the content of attached http://info/download/attachments/7962830/repo.xml.sql-server(note: change all "???" to real password)
content of repo.xml (inside
webapps\artifactory.war\WEB-INF\lib\artifactory-core-1.2.5-rc6.jar\jcr\repo.xml
inside artifactory-1.2.5-rc6.zip) with the content of attached http://info/download/attachments/7962830/repo.xml.sql-server(note: change all "???" to real password)
2. Include a
SQL-Server JDBC driver file into webapps\artifactory.war\WEB-INF\lib
SQL-Server JDBC driver file into webapps\artifactory.war\WEB-INF\lib
Following are
related information.
related information.
A. Artifactory
A1. JCR API
- JCR - Java
Content Repository - Standard: JSR-000170
A2. JCR Implementation
- Apache Jackrabbit - The Open
Source Content Repository for Java
A3. Default DB: Derby
This is the
part to be replaced by SQL-Server.
part to be replaced by SQL-Server.
A4. Switch to SQL-Server
- Configuring
Jackrabbit use SimpleDbPersistenceManager to replace DerbyPersistenceManager - Tricky is all in repo.xml
( plus a jdbc driver for sqlserver)
core/src/main/resources/jcr/repo.xml
inside svn source or webapps\artifactory.war\WEB-INF\lib\artifactory-core-1.2.5-rc6.jar\jcr\repo.xml
inside artifactory-1.2.5-rc6.zip or it could be /jcr/repo.xml under WEB-INF/classes or any classpath
preceeding WEB/INF/lib
inside svn source or webapps\artifactory.war\WEB-INF\lib\artifactory-core-1.2.5-rc6.jar\jcr\repo.xml
inside artifactory-1.2.5-rc6.zip or it could be /jcr/repo.xml under WEB-INF/classes or any classpath
preceeding WEB/INF/lib
A5. Issues TBD:
- How to pass
variables value into the repo.xml config file? db.server.name,
db.server.port, db.name, db.user, db.password option 1. Hard code in
the source code. option 2. Write a script to update at build / deploy
time.
- Move Web UI users data to
sqlserver too? Requires more research effort related to: org.springframework.jdbc.datasource.DriverManagerDataSource
- The link for deploy is available
to Reader/Search only user, the permission check is done after the user
uploaded the jar file and then get error message: Not enough permissions to deploy
artifact 'org.jfrog:artifactory:zip:1.2.5-rc6'.
B. SQL-SERVER
B1. DB Info:
- Server: sqlsrv01
- User: artifactory
- Database: repo (set owner to
"artifactory" user so that the db schema could be created
automatically) (Note: SQL-Server default installation disabled TCP/IP
protocal, use SQLServer Configuration Manager to enable it.)
B2. JTDS JDBC Driver
C.
Artifactory database switch architect diagram
Bottom of Form
Step 0.
Do a search first to see if the jar is already in Syscon internal repo.
Do a search first to see if the jar is already in Syscon internal repo.
Login as
"search" Username: search Password: password
"search" Username: search Password: password
Click "Search
for Artifacts" in the left side Enter the name of the jar and click the
"Go!" button
for Artifacts" in the left side Enter the name of the jar and click the
"Go!" button
Step 1.
Prepare to deploy a 3rd party jar into the repo Pre-condition: the 3rd
party jar file has been downloaded and verified. (e.g. to deploy
'icefaces-1.7.0.DR2.jar' )
Prepare to deploy a 3rd party jar into the repo Pre-condition: the 3rd
party jar file has been downloaded and verified. (e.g. to deploy
'icefaces-1.7.0.DR2.jar' )
Login as
"admin" Username: admin Password: xxxxxxxxx (set by the administrator)
"admin" Username: admin Password: xxxxxxxxx (set by the administrator)
Click "Deploy
an Artifact"
an Artifact"
Step 2.
Upload and deploy the pom file (optional if the 3rd party jar has no
dependency itself) (e.g. 'icefaces-1.7.0.DR2.pom') Note: Verify to make
sure: a. the value of "GroupId" is same as defined in the pom. b. the
value of "Packaging" is "pom". c. the checkbox "Use Jar POM/Generate
default POM" is UNCHECKED. Tip: Copy the value of the "GroupId". It will
be used in the next step. Click "Deploy" button.
Upload and deploy the pom file (optional if the 3rd party jar has no
dependency itself) (e.g. 'icefaces-1.7.0.DR2.pom') Note: Verify to make
sure: a. the value of "GroupId" is same as defined in the pom. b. the
value of "Packaging" is "pom". c. the checkbox "Use Jar POM/Generate
default POM" is UNCHECKED. Tip: Copy the value of the "GroupId". It will
be used in the next step. Click "Deploy" button.
Step 3.
Upload and deploy the jar file (e.g. 'icefaces-1.7.0.DR2.jar' )
Note&Tip: paste the value of "GroupId" from step 2. Verify and/or
correct the values of "ArtifactId", "Version" to make sure it's proper.
IMPORTANT: Leave the "Use Jar POM/Generate default POM" check-box as is.
Do NOT change it. Click "Deploy" button.
Upload and deploy the jar file (e.g. 'icefaces-1.7.0.DR2.jar' )
Note&Tip: paste the value of "GroupId" from step 2. Verify and/or
correct the values of "ArtifactId", "Version" to make sure it's proper.
IMPORTANT: Leave the "Use Jar POM/Generate default POM" check-box as is.
Do NOT change it. Click "Deploy" button.
Step 4.
Last but not least, verify the jar is in the repo and the pom is
correct. Click "Browsing" ==> "Repositories Tree" and navigate to the
jar file through package names
Last but not least, verify the jar is in the repo and the pom is
correct. Click "Browsing" ==> "Repositories Tree" and navigate to the
jar file through package names
Right click on
the pom file and select "View" from the popup menu.
the pom file and select "View" from the popup menu.
Verify the pom
file content is correct. (the values of "groupId", "artifactId",
"version", etc.. and dependencies reference included.)
file content is correct. (the values of "groupId", "artifactId",
"version", etc.. and dependencies reference included.)