Build React Native App (4) - Redux, Jest, and NativeBase

I've been using bitbucket cloud service and we would like to use pipeline, but we have a challenge on the library. Most project has library and will be needed our own repository. However, this has drawback to use pipleline if we set the repository type as private. We can't set the login and password from cloud.
There are two ways to configure bitbucket as repository; one method is to use one repository with two different branch and the other mehtod is to use two different repositories to servce release and snapshot. We will choose 2nd choice.
Run ssh-keygen to generate id_rsa.pub key
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/alexjoh/.ssh/id_rsa):
Created directory '/Users/alexjoh/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/alexjoh/.ssh/id_rsa.
Your public key has been saved in /Users/alexjoh/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:ER8bDtboRDUyIs6f/qBE4om3L+2f+/lkaKc2Hsrc0+w alexjoh@Alexs-MBP.hitronhub.home
The key's randomart image is:
+---[RSA 2048]----+
| . ..B+= |
| o . ooB.= |
| o o. + |
| . ... |
| . . o S |
| o + . . |
|. +.. o +o+ |
| ..o.+ B+Bo |
| .++.B=B=E |
+----[SHA256]-----+
alexjoh at Alexs-MBP in ~/Projects/repos/personal/blogmarkdown on master*
$ ls ~/.ssh/id_rsa.pub
/Users/alexjoh/.ssh/id_rsa.pub
alexjoh at Alexs-MBP in ~/Projects/repos/personal/blogmarkdown on master*
$
Copy id_rsa.pub contents to clipboard
Click profile icon and click and user setting
Select Bitbucket Setting
Select SSH Keys
Click Add Key
Click Add Keys
alexjoh at Alexs-MBP in ~/Projects/repos/personal/blogmarkdown on master*
$ ssh -T alexjoh@bitbucket.org
Warning: Permanently added the RSA host key for IP address '104.192.143.3' to the list of known hosts.
logged in as alexjoh.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
If you see the "logged in ...", the ssh connection is working
There are two ways to configure for Maven repository. One is using branches, release and snapshots, and the other is creating two different repository. I prefer the second options, so I will create two maven repositories called "maven_release" and "maven_snapshots".
To work with this, you will need special plugin for bitbucket
<pluginRepositories>
<pluginRepository>
<id>synergian-repo</id>
<url>https://raw.github.com/synergian/wagon-git/releases</url>
</pluginRepository>
</pluginRepositories>
Note: This part can be configured in settings.xml file as well.
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>maven_release</id>
<name>Maven Release</name>
<url>git:master://git@bitbucket.org:flairitshare/maven_release.git</url>
</repository>
<repository>
<id>maven_snapshot</id>
<name>Maven Snapshot</name>
<url>git:master://git@bitbucket.org:flairitshare/maven_snapshots.git</url>
</repository>
</repositories>
Note: This part can be configured in settings.xml file as well.
<distributionManagement>
<repository>
<id>maven_release</id>
<name>Maven Release</name>
<url>git:master://git@bitbucket.org:flairitshare/maven_release.git</url>
</repository>
<snapshotRepository>
<id>maven_snapshot</id>
<name>Maven Snapshot</name>
<url>git:master://git@bitbucket.org:flairitshare/maven_snapshots.git</url>
</snapshotRepository>
</distributionManagement>
Note: This part can be configured in settings.xml file as well.
Entire sample settings xml and pom.xml is in the github.
<settings>
<localRepository>D:/mavenrepo/.m2/Repository</localRepository>
<servers>
<server>
<id>maven_release</id>
<username>username</username>
<password>password</password>
</server>
<server>
<id>maven_snapshots</id>
<username>username</username>
<password> password </password>
</server>
</servers>
</settings>
[ansible@ns01 ]$ mvn deploy
...
[INFO] Installing /home/ansible/repo/odatabuilder/target/ODataBuilder-0.0.1-SNAPSHOT.jar to /home/ansible/.m2/repository/com/local/components/ODataBuilder/0.0.1-SNAPSHOT/ODataBuilder-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/ansible/repo/odatabuilder/pom.xml to /home/ansible/.m2/repository/com/local/components/ODataBuilder/0.0.1-SNAPSHOT/ODataBuilder-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ ODataBuilder ---
Downloading from snapshots: http://artifactory.svctest.local:49200/artifactory/libs-snapshot-local/com/local/components/ODataBuilder/0.0.1-SNAPSHOT/maven-metadata.xml
...
This shows how to setup bitbucket as maven repository and you can do it from github as well.
Comments
Post a Comment