maven jar(artifact)들을 수동으로 올렸다.

총 4가지 방식으로 deploy 하는 방식인데..

 

1. svn 주소 알려주고 deploy 요청

2. jar, source-jar, javadoc-jar 를 한번에 같이 요청 - 소스 프로젝트를 통째로 받아야 하는 불편함이 있음

3. pom.xml 파일과 jar 주고 deploy 요청

4. pom.xml 파일없이 deploy 요청 

 

nexus (1.7.0)을 설치하였지만, pom.xml 파일을 읽지 못하는 문제가 있어서 제대로 사용을 못했다. 이번에 패치(1.8.0.1)을 올려서 운영해보니.. 잘 올라감

위의 2,3,4를 지원해줍니다. 1번은 그쪽에 정식으로 요청할 생각.

 
nexus의 기본 특징은 편의성과 보안성이 특징이다.

톰캣의 webapps에 war만 올려놓으면 되고, 설정파일은 ${사용자계정}/sonatype-work에 저장된다..

계정이 있는 사람들만 업로드를 할 수 있으니, 보안문제가 좀 편하다.

 

그 다음으로 좋은 특징은 repository grouping 입니다.저희가 그동안 써왔던 repository 정보들을 하나의 이름으로 쓸 수 있습니다. 일종의 repository 내용을 짬뽕해줍니다..

변경된 코드

<repositories>
  <repository>
   <id>nhn</id>
   <url>http://repo.google.com/nexus/content/groups/nhn/</url>
  </repository>
 </repositories>

 

*관련자료

 

Artifactory, Archiva, Nexus  비교자료
http://docs.codehaus.org/display/MAVENUSER/Maven+Repository+Manager+Feature+Matrix

 

Archiva가 문제가 많아서 nexus로 바꿨다는 이야기

http://www.sonatype.com/people/2009/07/from-apache-archiva-to-sonatype-nexus/

•500 or 502 errors on uploads in Archiva without any apparent reason (I tried to track down the issues without success),
•Many periods of unavailability of Archiva or Bamboo after exceeding the maximum number of open file descriptors allowed for the user. We must concede that these tools handle a lot of files (downloads, uploads, and other manipulations on a large number of artifacts). Archiva easily exceeds the default limit of 1024 descriptors which forced us to increase it. But even at 2048 Archiva would still occasionally exceed the limit.
•Inability to download snapshots if the local repository used by Bamboo was emptied just prior to that. This resulted in regular failures of our Maven sites or Sonar builds.


 

Posted by '김용환'
,



1.  pom.xml 확인하고, 프로젝트\target\generated-source\archetype에서 deploy 하기

(1) pom.xml 확인
pom.xml 은 다음과 같은 형태음을 확인

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.archetype</groupId>
  <artifactId>maven-google-archetype</artifactId>
  <version>1.7.0</version>
  <packaging>maven-archetype</packaging>
  <name>Maven Archetype for Google Web Application</name>
  <inceptionYear>2011</inceptionYear>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.archetype</groupId>
        <artifactId>archetype-packaging</artifactId>
        <version>2.0</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>2.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

 <distributionManagement>
  <repository>
 ........<비공개>
  </repository>
  <snapshotRepository>
.........<비공개>
  </snapshotRepository>
 </distributionManagement>
 
</project>

(2) deploy 한다.


프로젝트폴더\target\generated-sources\archetype>mvn deploy



(3) Build successful 뜨는지 확인
(내용을 보면 실제 deploy된 위치가 나옴)

 

2. 업로드 확인

위치 확인    http://서버이름/maven2/com/google/archetype/maven-google-archetype/

Index of /maven2/com/google/archetype/maven-google-archetype

Name                           Last modified      Size 
Parent Directory                                    -  
1.5.6/                         22-Apr-2010 18:32    -  
1.7.0/                         14-Jan-2011 15:04    -  
maven-metadata.xml             14-Jan-2011 15:04  377  
maven-metadata.xml.md5         14-Jan-2011 15:04   32  
maven-metadata.xml.sha1        14-Jan-2011 15:04   40  
maven-metadata.xml3            14-Jan-2011 15:48  346  

 

3. Maven 서버에 archetype 선택 메뉴 나오게 수정

[www@xsvn01.sps maven2]$ ls -al /home1/repository/maven2/archetype-catalog.xml
-rw-r--r-- 1 www www 1295  1¿u 14 16:01 /home1/repository/maven2/archetype-catalog.xml


<?xml version="1.0" encoding="UTF-8"?><archetype-catalog>
  <archetypes>
    <archetype>
      <groupId>com.google.archetype</groupId>
      <artifactId>maven-aaa-archetype</artifactId>
      <version>2.5.1</version>
      <repository>http://서버이름/maven2</repository>
      <description>Maven Archetype for AAA Web Application</description>
    </archetype>
    <archetype>
      <groupId>com.google.archetype</groupId>
      <artifactId>maven-bbb-archetype</artifactId>
      <version>2.3.2</version>
      <repository>http://서버이름/maven2</repository>
      <description>Maven Archetype for BBB Module</description>
    </archetype>
    <archetype>
      <groupId>com.google.archetype</groupId>
      <artifactId>maven-google-archetype</artifactId>
      <version>1.5.6</version>
      <repository>http://서버이름/maven2</repository>
      <description>Maven Archetype for Google Web Application</description>
    </archetype>

  <!-- 추가된 부분 start-->
    <archetype>
      <groupId>com.google.archetype</groupId>
      <artifactId>maven-google-archetype</artifactId>
      <version>1.7.0</version>
      <repository>http://서버이름/maven2</repository>
      <description>Maven Archetype for Google Web Application</description>
    </archetype>
  <!-- 추가된 부분 end-->
  </archetypes>
</archetype-catalog>




4. 확인

mvn archetype:generate -DarchetypeCatalog=http://서버이름/maven2

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from google repository
[INFO] org.codehaus.mojo: checking for updates from goggle repository
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin: checking for up
dates from goggle repository
[INFO] ------------------------------------------------------------------------
[INFO] Building google 1.7 example
[INFO]    task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Interactive mode
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.
archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
1: http://서버이름/maven2 -> maven-aaa-archetype (Maven Archetype for US
F Web Application)
2: http://서버이름/maven2 -> maven-bbb-archetype (Maven Archetype for B
LOC Module)
3: http://서버이름/maven2 -> maven-google-archetype (Maven Archetype for Google Web Application)
Choose a number: : 3
Choose version:
1: 1.5.6
2: 1.7.0
Choose a number: : 2

 


5. 예외 케이스

[ERROR] org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom'
org.apache.maven.archetype.exception.ArchetypeGenerationFailure: org.apache.maven.archetype.exception.InvalidPackaging: Unable to add module to the current project as it is not of packaging type 'pom'


만약 archetype을 받는데, 위의 exception이 난다고 하면, 클라인언트 디렉토리에 이미 존재했을 수 있음..
다른 디렉토리에 해서 받으면 ok됨

 

 

* 직접 다운받기

과정없이 직접 archetype을 다운받는 방법
mvn archetype:generate -DarchetypeCatalog=http://서버위치/maven2   -DarchetypeGroupId=com.google.archetype -DarchetypeArtifactId=maven-goggle-archetype   -DarchetypeVersion=1.7.0

 

'etc tools' 카테고리의 다른 글

[maven2] 관련 lib들을 하나의 jar로 묶어주기 - assembly  (0) 2011.02.28
[Maven Deploy 툴 Nexus 활용]  (0) 2011.02.09
JUNIT4 Suite -> ClasspathSuite  (0) 2010.09.01
[ANT] fixcrlf  (0) 2010.07.29
maven의 exclusion 고민  (0) 2010.07.21
Posted by '김용환'
,


JUNIT4 Suit 라는 개념이 있어서, Test Case를 동작시킨다.

@RunWith(Suite.class)
@SuiteClasses( { Test1.class, Test2.class , Test3.class})
public class AllTests {}

 

test/java에 있는 TestCase들을 탐색을 하고, SuiteClasses TestCase를 추가하여 테스트하는 구조이다.

근데.. Classpath를 이용해서 모든 Test Case를 실행시켜주는 것을 발견했다.

ClasspathSuite(http://johanneslink.net/projects/cpsuite.jsp)는 이런 탐색 고민을 안해도 된다.

그냥 Classpath 안에 모든 TestCase를 실행시켜준다!!

import org.junit.extensions.cpsuite.ClasspathSuite;
import org.junit.runner.RunWith;
@RunWith(ClasspathSuite.class)
public class MySuite {}

 

또한, Filtering (white, black list 가능)도 되구요.

import org.junit.extensions.cpsuite.ClasspathSuite.*;
...
@ClassnameFilters({"mytests.*", ".*Test"})
public class MySuite...

 

Test할때 아주 편할듯~

'etc tools' 카테고리의 다른 글

[Maven Deploy 툴 Nexus 활용]  (0) 2011.02.09
[Maven서버] Maven 서버에 Archetype 새로 추가하기  (0) 2011.02.09
[ANT] fixcrlf  (0) 2010.07.29
maven의 exclusion 고민  (0) 2010.07.21
ivy vs maven 2 비교 자료  (0) 2010.07.07
Posted by '김용환'
,

[ANT] fixcrlf

etc tools 2010. 7. 29. 09:56


<fixcrlf srcdir="${dist}/src"
excludes="**/*.bin,**/*.bmp,**/*.dia,**/*.exe,**/*.gif,**/*.ico,**/*.jar,**/*.jpg,**/*.pdf,**/*.rtf,**/*.war"
eol="lf" fixlast="false" encoding="ISO-8859-1" />


ant에서 EOF 또는 EOS invalid character 와 같이 쓸데없이 character 가 나오는 것을 방지한다..

자세한 내용은 이곳을 참고할 것.
http://ant.apache.org/manual/Tasks/fixcrlf.html

'etc tools' 카테고리의 다른 글

[Maven서버] Maven 서버에 Archetype 새로 추가하기  (0) 2011.02.09
JUNIT4 Suite -> ClasspathSuite  (0) 2010.09.01
maven의 exclusion 고민  (0) 2010.07.21
ivy vs maven 2 비교 자료  (0) 2010.07.07
Load Runner 대체 툴 Grinder  (1) 2010.02.01
Posted by '김용환'
,

maven을 쓸 때마다 depency 때문에 생기는 exclusion을 고민할 수 밖에 없다.
점차 고도화되는 app...

http://whiteship.me/1763


내 생각에는 ivy가 그 역할을 대신하지 않을까 싶다..


'etc tools' 카테고리의 다른 글

JUNIT4 Suite -> ClasspathSuite  (0) 2010.09.01
[ANT] fixcrlf  (0) 2010.07.29
ivy vs maven 2 비교 자료  (0) 2010.07.07
Load Runner 대체 툴 Grinder  (1) 2010.02.01
Ant 조건에 따라 실행하기  (0) 2009.07.29
Posted by '김용환'
,



경험을 바탕으로 간단히.. maven(maven2) vs ivy 장단점 비교를 해보겠습니다.

-  의존성 다운로드
1) ivy : 선택에 의해서 다운로드 가능. 해당 jar외엔 아무것도 받지 않겠다라고 쓸 수 있음. 명시적인 lib 관리 가능
2) maven : 불필요한 jar도 다운받을 수 있습니다. 쓰지 않더라도 선언때문에 다운 받을 수 있고, 상황에 따라서는 exclude 해줘야 함. 
(운영상..  maven을 못 쓴 이유가 바로 이런 불편함이었습니다. 쉽게 운영을 위해서는 명시적인 lib 외엔 다른 것을 쓰지 않도록 하는 것이 더 편리하고 명확합니다. )

- 라이브러리 경합
1) ivy : 유연성 제공, 같은 라이브러리, 버젼일 때, conflict manager 사용가능
2) maven : 같은 라이브러리라도 다른 버젼이면 맨 처음 선언된 artifact에 맞춰 다운로드 됩니다. maven plugin에서는 이 부분이 달라진다.. 결국 버젼 관계를 설정할 방법이 없습니다.

- 의존성 lib 기술 방법
1) ivy : property 이용. 
2) maven : element 단위.

- 이클립스 상
1) ivy : jar만 다운받으면, ant 상에서 빌드 가능, 플러그인 설치 필요 없음
2) maven : m2 플러그인 설치를 통해서 빌드 해야 함

- 장점
1) ivy : ant와 동시에 쓰면서 세밀한 작업이 가능함. 디렉토리 위치를 편하게 관리. 복잡해질 수 있는 소지. ant 의 condition 같은 구린 것이 if / else로도 쓸 수 있도록 지원.
2) maven : 플러그인을 편하게 쓸 수 있음. 간단한 구조에 좋음.

- ivy의 단점 : 파일 이름에 명시적인 패턴을 요구 합니다.


* ant + ivy는 spring 3 에서 사용하고 있습니다. 그 외에서 reference하는 곳는 많지는 않은 듯 합니다.


* 경험상..
maven은 작은 모듈에 적합
ant+ivy는 배포서버나, 세밀함이 필요한 곳에 적합


<볼만한 ivy 이야기>

http://toby.epril.com/?p=557   

http://www.ibm.com/developerworks/kr/library/j-ap05068/index.html#listing1

http://objectopia.com/2009/06/21/a-robust-build-for-a-many-component-platform-using-aspects-of-maven-ant-and-ivy-part-1/

http://stackoverflow.com/questions/194125/is-ant-still-the-best-choice-for-a-java-build-tool



'etc tools' 카테고리의 다른 글

[ANT] fixcrlf  (0) 2010.07.29
maven의 exclusion 고민  (0) 2010.07.21
Load Runner 대체 툴 Grinder  (1) 2010.02.01
Ant 조건에 따라 실행하기  (0) 2009.07.29
라이브온에어  (0) 2009.04.07
Posted by '김용환'
,

내가 이번에 개발할려고 했는데.. 이미 있었다니~ ㅋㅋ

 

Grinder : Http request Load test tool (Java) + script (Jython)

http://grinder.sourceforge.net/

 

Grind 분석 툴 : Jython 이용

http://track.sourceforge.net/analyzer.html



http://track.sourceforge.net/example/report.html

Transacton Name Tests Passed Tests w/ Errors Pass Rate Mean Response Time Response time standard dev. Mean Response Length Bytes per Sec Mean Time Resolve Host Mean Time Establish Connection Mean Time to First Byte
Fast Login 0.0 55.0 0.000 944.21 1019.49 355.72 -1 0.09 650.2 1010.46
Login 898.0 0.0 1.000 1325.5 1677.74 352.05 -1 0.09 725.21 1324.24
Create Account 858.0 0.0 1.000 1285.64 1557.91 119.0 -1 0.09 661.97 1283.84
Update Account 5817.0 0.0 1.000 1730.63 1795.83 428.0 -1 0.1 659.37 1729.29
Deactivate User 121.0 0.0 1.000 1578.45 1687.1 99.0 -1 0.17 643.45 1577.89
Browse type 1 111.0 0.0 1.000 4594.23 3427.63 6195.24 -1 0.14 671.67 4586.51
Browse Type 2 6193.0 0.0 1.000 1228.87 1586.81 811.0 -1 0.1 642.8 1227.41
Search by Name 813.0 6.0 0.993 1378.75 1684.09 1824.19 -1 0.11 659.5 1375.99
Search by Price 871.0 0.0 1.000 1385.51 1681.41 74.0 -1 0.09 731.99 1384.77
Search by Author 886.0 2.0 0.998 1823.12 1872.8 112.0 -1 0.1 869.49 1821.16
Create Watch List 874.0 0.0 1.000 1339.09 1613.52 114.22 -1 0.09 665.16 1338.13
Add to watch list 931.0 0.0 1.000 1292.77 1600.7 106.0 -1 0.12 667.61 1291.44
Delete watch list 2852.0 36.0 0.988 2053.83 1841.4 399.0 -1 0.1 656.01 2051.89
Add to Cart 5879.0 1.0 1.000 1729.65 1802.7 400.0 -1 0.1 642.64 1727.78
Delete from Cart 79.0 3.0 0.963 2054.34 1892.47 129.0 -1 0.08 599.68 2053.85
Payment Info 898.0 0.0 1.000 1393.21 1680.36 114.87 -1 0.11 748.03 1390.97
Update Payment 434.0 0.0 1.000 672.1 885.18 96.0 -1 0.09 84.3 670.82
Send Feedback 53.0 0.0 1.000 579.04 528.94 96.0 -1 0.08 0.58 578.36
Purchase Cart 999.0 3.0 0.997 2623.9 2164.44 5545.38 -1 0.1 611.53 2620.48
Product Info 49.0 0.0 1.000 739.14 760.77 99.0 -1 0.06 61.9 738.82
Product Details 167.0 0.0 1.000 1313.04 1539.51 106.0 -1 0.14 547.04 1309.73
Account History 7667.0 0.0 1.000 1755.2 1812.36 1543.0 -1 0.09 950.56 1753.24
Recommend Stuff 1.0 0.0 1.000 7.0 0.0 11235.0 -1 1.0 1.0 6.0
Totals 37451.0 106.0 0.997 1631.05 1791.33 841.87 -1 0.1 713.81 1629.31

'etc tools' 카테고리의 다른 글

maven의 exclusion 고민  (0) 2010.07.21
ivy vs maven 2 비교 자료  (0) 2010.07.07
Ant 조건에 따라 실행하기  (0) 2009.07.29
라이브온에어  (0) 2009.04.07
여러 줄에서 특정 정규 패턴 찾아내기  (1) 2009.03.09
Posted by '김용환'
,

 

Ant는 if문이 있지만, core에는 없고 contribute.jar(?) 라는 파일을 써야 if 조건을 쓸 수 있다.
core만 가지고 실행할 수 있도록 하나 만들었다.
condition과 antcall. target만 가지고도 비슷하게 만들 수 있다.

build.properties

dbpropmanager.application=false


build.xml
<target name="build">
....
  <condition property="applied" value="false">
   <equals arg1="${dbpropmanager.application}" arg2="false" />
  </condition>
  <condition property="applied" value="true">
   <not><equals arg1="${dbpropmanager.application}" arg2="false" /></not>
  </condition>  
  <antcall target="dbpropmanager_${applied}"/>
</target>



 <target name="dbpropmanager_true">
     <taskdef name="dbPropertiesTask" classname="com.google.laputa.dbpropmanager.anttask.AntTaskTest" />
     <dbPropertiesTask server="${settings.dbProperiesManagerServer}"/>
        <echo message="DB Properties Client Module was executed." />
 </target>
 
 <target name="dbpropmanager_false">
        <echo message="DB Properties Client Module was not executed." />
 </target>

'etc tools' 카테고리의 다른 글

ivy vs maven 2 비교 자료  (0) 2010.07.07
Load Runner 대체 툴 Grinder  (1) 2010.02.01
라이브온에어  (0) 2009.04.07
여러 줄에서 특정 정규 패턴 찾아내기  (1) 2009.03.09
ACK 의 위력 (faster than grep)  (0) 2009.03.04
Posted by '김용환'
,

라이브온에어

etc tools 2009. 4. 7. 21:47
http://liveonair.org/zbxe/

인터넷 상으로 간단한 TV나 라디어를 들을 수 있는 툴.
일반 방송때문 아니라 외국 방송을 들을 때. 많은 도움이 된다.

개인적으로 영어 방송이나 잉글리쉬닷컴 방송을 들을 때 사용한다.

'etc tools' 카테고리의 다른 글

Load Runner 대체 툴 Grinder  (1) 2010.02.01
Ant 조건에 따라 실행하기  (0) 2009.07.29
여러 줄에서 특정 정규 패턴 찾아내기  (1) 2009.03.09
ACK 의 위력 (faster than grep)  (0) 2009.03.04
7zip과 bzip2의 비교  (0) 2009.03.02
Posted by '김용환'
,

multilne 에서 특정 regular expression을 써서 특수하게 쓰는 경우만 찾는 경우입니다.

 

 

grep이나 sed multiline이 검색할 수 있는지 확인해보니.. 기본적으로 단순히 readline을 기준으로 한 것이라 멀티라인과 같은 경우는 하이레벨 렝귀지를 써야 합니다.  ..

 

아래와 같은 것을 찾으려 하면, a태그 안에 주석문이 있는지 체크하려는 것을 보려면, 일반적으로 grep –i를 때려주면 편합니다만.   Side effect 가 있기도 하지요.

<a>

 /***

*

  */

</a>

 

너무 파일이 겁나게 많으면 별로 큰 소용이 없기도 합니다..

 

혹시 검색이 필요하시면 이걸 쓰세요. ^^

 

Grep1.pl

#!/usr/bin/perl

use strict;

my $filename = shift;

open (FILE, "<", $filename)  or  die "Failed to read file $filename : $! \n";

my $whole_file;

{

    local $/;

    $whole_file = <FILE>;

}

close(FILE);

while ($whole_file =~ m#\<c:if\>(.*?)\<\!--(.*?)--\>(.*?)\<c:when>(.*?)\</c:when>(.*?)\<\/c:if\>#sg) {

    print $1 . $2. $3. $4. $5. $6. $7."\n";

}

 

a.txt

 

a

a

a

a

a

<a>aa

</a>

<c:if>

1

<!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -->

<c:when>

2

</c:when>

3

</c:if>

4

 

 

b.txt

a

a

a

a

a

<a>aa

</a>

<c:if>

1

<c:when>

2

</c:when>

3

</c:if>

4

 

'etc tools' 카테고리의 다른 글

Ant 조건에 따라 실행하기  (0) 2009.07.29
라이브온에어  (0) 2009.04.07
ACK 의 위력 (faster than grep)  (0) 2009.03.04
7zip과 bzip2의 비교  (0) 2009.03.02
디렉토리 비교, 3개의 파일 비교 가능 툴  (0) 2009.02.20
Posted by '김용환'
,