생각하는 족족 고.따.구 냐..

Posted
Filed under About Knowledge/Programs_Java
...
apply plugin: 'java'
apply plugin: 'maven-publish'
...

...
jar {
    into("META-INF/maven/$project.group/$project.name") {
        from { generatePomFileForMavenJavaPublication }
        rename ".*", "pom.xml"
    }
}
...



group 'com.my-group'
version '1.0'

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = rootProject.name
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
        }
    }

    repositories {
        maven {
            credentials {
                username 'username'
                password 'password'
            }
            url 'http://localhost:8081/repository/my/'
        }
    }
}

============================================================================
gradle clean build -x test publish

============================================================================

https://docs.gradle.org/current/userguide/viewing_debugging_dependencies.html
2021/03/23 10:57 2021/03/23 10:57
Posted
Filed under About Knowledge/Programs_Java
spring boot bootRun argument

$ ./gradlew bootRun --args='--spring.profiles.active=dev'
2021/03/08 11:14 2021/03/08 11:14
Posted
Filed under About Knowledge/Programs_Java

publish with pom-dependencies

to set plugins

...
apply plugin: 'java'
apply plugin: 'maven-publish'
...

to include pom.xml

...
jar {
    //from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
    into("META-INF/maven/$project.group/$project.name") {
        from { generatePomFileForMavenJavaPublication }
        rename ".*", "pom.xml"
    }
}
...

to set publication

group 'com.my-group'
version '1.0'

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId = rootProject.name
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
        }
    }

    repositories {
        maven {
            credentials {
                username 'username'
                password 'password'
            }
            url 'http://localhost:8081/repository/my/'
        }
    }
}

to build

command> gradle clean build -x test publish  # native gradle
# or
command> ./gradlew clean build -x test publish # gradle wrapper 

 

2021/02/22 22:32 2021/02/22 22:32
Posted
Filed under About Knowledge/OS_Linux
한글이 풀어쓰기 현상은 특정 폰트가 사용되어서 발생하는 경우가 있다

fedora의 경우 "google-droid-sans-fonts" 를 삭제하면 풀어쓰기 현상이 없어진다.
2021/02/01 14:06 2021/02/01 14:06
Posted
Filed under About Knowledge/OS_Linux
ip route add 172.17.19.0/24 via 10.8.0.13
2020/11/14 15:25 2020/11/14 15:25
Posted
Filed under About Knowledge/OS_Linux
yum install –y epel-release
yum install update -y
yum install -y openvpn
openvpn --config /경로/클라이언트명.ovpn
2020/11/13 15:58 2020/11/13 15:58
Posted
Filed under About Knowledge/Programs_Java
URL url = ${TARGET_CLASS}.class.getProtectionDomain().getCodeSource().getLocation();
2020/11/12 13:42 2020/11/12 13:42
Posted
Filed under About Knowledge/Programs_Java
java에서 x509 인증서(certificate)를 읽어온다.

            CertificateFactory fact = CertificateFactory.getInstance("X.509");
            FileInputStream is = new FileInputStream("./lib/license/felice.pem");
            result = (X509Certificate) fact.generateCertificate(is);
          
            // 인증서를 검증한다.
            result.verify( ${OTHER_CERT}.getPublicKey()
2020/11/12 13:41 2020/11/12 13:41
Posted
Filed under About Knowledge/Programs_Java
signed jar파일에서 인증서(certificate)를 읽어온다.

X509Certificate result = null;
        try {
            //InputStream in = X509Certificate.class.getResourceAsStream("classpath:META-INF/xxxxx.RSA");
            InputStream in = new ClassPathResource("META-INF/xxxxxx.RSA").getInputStream();
            byte[] buffer = in.readAllBytes();
            in.close();
            //Corresponding class of signed_data is CMSSignedData
            CMSSignedData signature = new CMSSignedData(buffer);
            Store cs = signature.getCertificates();
            SignerInformationStore signers = signature.getSignerInfos();
            Collection c = signers.getSigners();
            Iterator it = c.iterator();
            //the following array will contain the content of xml document
            //byte[] data = null;
            while (it.hasNext()) {
                SignerInformation signer = (SignerInformation) it.next();
                Collection certCollection = cs.getMatches(signer.getSID());
                Iterator certIt = certCollection.iterator();
                X509CertificateHolder cert = (X509CertificateHolder) certIt.next();

                CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
                InputStream in2 = new ByteArrayInputStream(cert.getEncoded());
                result = (X509Certificate) certFactory.generateCertificate(in2);

                if( null != result)
                    break;
                //CMSProcessable sc = signature.getSignedContent();
                //data = (byte[]) sc.getContent();
            }
        } catch (CertificateException | CMSException | IOException e) {
            log.error("",e);
        }
        return result;
2020/11/12 13:38 2020/11/12 13:38
Posted
Filed under About Knowledge/OS_Linux
1. generate ssh on remote -host and copy it on server
  ex> prompt>ssh-keygen -t rsa

2. copy private key on server
   ex> cat ~/.ssh/id_rsa
  
3. install ssh client ( ssh-agent, ssh-add ) on client
 ex.> promprt>dnf install openssh-client
4. run ssh client on client
  ex> prompt>eval $(ssh-agent -s)
5. Adding environment's variable SSH_PRIVATE_KEY to the SSH client's agent that manages the private keys on client
  ex> prompt>echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
6. Create the SSH directory and give it the right permissions on client
  ex> prompt> mkdir -p ~/.ssh
      prompt> chmod 700 ~/.ssh

7. execute remote script via ssh on client
ssh -o StrictHostKeyChecking=no root@stg.sp-kcc.ml "cd /opt/felice && ./re-deploy-felice.sh && /opt/felice-src/reload-openapi.sh"
2020/09/25 10:08 2020/09/25 10:08