Maven 프로젝트 설정

붐 라마다

현재 다음과 같은 종속성이있는 평면 구조의 프로젝트가 있습니다.

    Core  --> core.jar
            Service --> WAR
            Domain --> domain.jar
                    Web  -> WAR

거의 모든 것이 Core 모듈의 core.jar에 의존하고 Web은 Core에 의존하는 Domain 모듈의 domain jar에 의존합니다.

이것을 Maven으로 변환 할 계획입니다. 사용할 수있는 최상의 구조에 대한 피드백이 필요합니다.

내가 가진 선택은 현재 구조를 유지 한 다음 각 모듈에서 jar 파일을 생성하고 maven과의 종속성의 일부로 사용하는 것입니다. 또는 도움이 필요한 일종의 계층 구조로 모듈을 재구성하십시오.

Maven의 모범 사례 사용을 따르고 싶습니다.

stringy05

하위 프로젝트에서 종속성을 관리하는 데 사용할 수있는 상위 pom을 설정합니다. 그런 다음 각 jar / war 아티팩트를 모듈로 설정하십시오.

각 모듈 <dependencies>은 모듈 pom 의 normal 사용하여 종속성을 소싱합니다.

그래서 이것을 가지고 :

parent-project [pom]: 
    modules: 
       core [jar]
       domain [jar] - depends on core
       service [war] - depends on core
       web [war] - depends on domain

그리고 구체적인 예로서, 여기 내 프로젝트 중 하나의 샘플이 있습니다.

부모 pom

<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>org.example</groupId>
    <artifactId>myproject-parent</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <name>myproject-parent</name>
    <url>http://maven.apache.org</url>

    <properties>
        <jersey.version>2.6</jersey.version>
        <jsonunit.version>1.5.5</jsonunit.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.1.4.RELEASE</spring.version>
    </properties>

    <modules>
        <module>api-client</module>
        <module>load-tests</module>
        <module>regression-tests</module>
    </modules>


    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-report-plugin</artifactId>
                <version>2.18.1</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>cobertura-maven-plugin</artifactId>
                <version>2.7</version>
            </plugin>
        </plugins>
    </reporting>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
                <scope>compile</scope>
            </dependency>

            <dependency>
                <groupId>org.glassfish.jersey.core</groupId>
                <artifactId>jersey-client</artifactId>
                <version>${jersey.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.media</groupId>
                <artifactId>jersey-media-json-jackson</artifactId>
                <version>${jersey.version}</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.connectors</groupId>
                <artifactId>jersey-apache-connector</artifactId>
                <version>${jersey.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.3.2</version>
            </dependency>
            <dependency>
                <groupId>commons-cli</groupId>
                <artifactId>commons-cli</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.7.10</version>
            </dependency>

            <dependency>
                <groupId>ch.qos.logback</groupId>
                <artifactId>logback-classic</artifactId>
                <version>1.1.2</version>
            </dependency>
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.11</version>
            </dependency>

            <dependency>
                <groupId>org.thymeleaf</groupId>
                <artifactId>thymeleaf</artifactId>
                <version>2.1.4.RELEASE</version>
            </dependency>

            <dependency>
                <groupId>org.mockito</groupId>
                <artifactId>mockito-core</artifactId>
                <version>2.0.5-beta</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path</artifactId>
                <version>2.0.0</version>
            </dependency>
            <dependency>
                <groupId>com.jayway.jsonpath</groupId>
                <artifactId>json-path-assert</artifactId>
                <version>2.0.0</version>
                <scope>test</scope>
            </dependency>

            <dependency>
                <groupId>org.freemarker</groupId>
                <artifactId>freemarker</artifactId>
                <version>2.3.22</version>
            </dependency>


            <dependency>
                <groupId>net.javacrumbs.json-unit</groupId>
                <artifactId>json-unit</artifactId>
                <version>${jsonunit.version}</version>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.json-unit</groupId>
                <artifactId>json-unit-fluent</artifactId>
                <version>${jsonunit.version}</version>
            </dependency>
            <dependency>
                <groupId>dom4j</groupId>
                <artifactId>dom4j</artifactId>
                <version>1.6.1</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

API 클라이언트

<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>

    <artifactId>api-client</artifactId>
    <packaging>jar</packaging>
    <parent>
        <groupId>org.example</groupId>
        <artifactId>myproject-parent</artifactId>
        <version>1.0.0</version>
    </parent>

    <properties>
        <xmlunit.version>2.0.0-alpha-03</xmlunit.version>
    </properties>


    <name>api-client</name>
    <url>http://maven.apache.org</url>

    <dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.connectors</groupId>
            <artifactId>jersey-apache-connector</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-cli</groupId>
            <artifactId>commons-cli</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
        </dependency>

        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path</artifactId>
        </dependency>
        <dependency>
            <groupId>com.jayway.jsonpath</groupId>
            <artifactId>json-path-assert</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-core</artifactId>
            <version>${xmlunit.version}</version>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-matchers</artifactId>
            <version>${xmlunit.version}</version>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.json-unit</groupId>
            <artifactId>json-unit</artifactId>
        </dependency>
        <dependency>
            <groupId>net.javacrumbs.json-unit</groupId>
            <artifactId>json-unit-fluent</artifactId>
        </dependency>
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
        ... snip ...
        </plugins>
    </build>



</project>

마지막으로 api-client에 의존하는로드 테스트

<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>

    <artifactId>load-tests</artifactId>
    <packaging>jar</packaging>
    <parent>
        <groupId>org.example</groupId>
        <artifactId>myproject-parent</artifactId>
        <version>1.0.0</version>
    </parent>

    <name>load-tests</name>
    <url>http://maven.apache.org</url>


    <dependencies>
        <dependency>
            <groupId>org.example</groupId>
            <artifactId>api-client</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>1.1.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
     ... snip ...
        </plugins>
    </build>


</project>

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Maven + IntelliJ 프로젝트 설정 재설정

분류에서Dev

Maven 3으로 Struts2 EAR 프로젝트 설정

분류에서Dev

Tomcat의 Java EE Maven 프로젝트에서 JavaAgent 설정

분류에서Dev

Tomcat의 Java EE Maven 프로젝트에서 JavaAgent 설정

분류에서Dev

Eclipse에서 Maven Java 프로젝트 설정

분류에서Dev

번들로 패키징을 설정할 때 Maven 프로젝트의 PluginVersionResolutionException

분류에서Dev

Maven 프로젝트의 클래스 경로를 설정하는 방법

분류에서Dev

spring + hibernate maven 프로젝트를 설정하는 데 문제가 있습니까?

분류에서Dev

Netbeans 및 Maven, 종속 프로젝트로 정리 및 빌드

분류에서Dev

빈 Maven 프로젝트를 설치할 수 없습니다.

분류에서Dev

Eclipse 버전 : Mars.2 (4.5.2)에 Maven 프로젝트 설치

분류에서Dev

Xamarin 프로젝트 설정

분류에서Dev

Maven : 프로젝트 사본 이름 지정

분류에서Dev

neatbeans maven javafx 프로젝트를 위해 Maven을 잘 설치하는 방법

분류에서Dev

Maven 프로젝트의 특정 테스트로 Jenkins 병렬 테스트

분류에서Dev

Intellij IDEA 2019.2 : 모든 프로젝트에 대해 Maven 홈 디렉토리를 "전역 적으로"설정

분류에서Dev

Maven 프로젝트에서 기본 매개 변수를 설정하는 방법은 무엇입니까?

분류에서Dev

Maven의 모든 프로젝트에 대한 기본 배포를 설정할 수 있나요?

분류에서Dev

javaCV Maven 프로젝트

분류에서Dev

셀레늄에서 특정 테스트 실행 (Eclipse IDE의 Maven 프로젝트)

분류에서Dev

Maven 빌드 프로젝트를 설치하는 방법은 무엇입니까?

분류에서Dev

Maven 프로젝트 패키징은 전쟁이지만 jar 빌드 / 설치

분류에서Dev

프로젝트 바로 아래에 'Maven Dependencies'폴더 아래에 Maven 종속성이 나열되는 Eclipse 프로젝트를 어떻게 수정합니까?

분류에서Dev

Maven 프로젝트에서 VS Code 시작을위한 projectName 결정

분류에서Dev

Maven은 mutil 모듈 Maven 프로젝트에서 설치 (패키지) 전에 컴파일해야합니다.

분류에서Dev

WPF 설정 Deplyoment 프로젝트

분류에서Dev

LibGDX 프로젝트 설정시 오류

분류에서Dev

Symfony 2.4 기본 프로젝트 설정

분류에서Dev

gitlab의 기본 프로젝트 설정

Related 관련 기사

  1. 1

    Maven + IntelliJ 프로젝트 설정 재설정

  2. 2

    Maven 3으로 Struts2 EAR 프로젝트 설정

  3. 3

    Tomcat의 Java EE Maven 프로젝트에서 JavaAgent 설정

  4. 4

    Tomcat의 Java EE Maven 프로젝트에서 JavaAgent 설정

  5. 5

    Eclipse에서 Maven Java 프로젝트 설정

  6. 6

    번들로 패키징을 설정할 때 Maven 프로젝트의 PluginVersionResolutionException

  7. 7

    Maven 프로젝트의 클래스 경로를 설정하는 방법

  8. 8

    spring + hibernate maven 프로젝트를 설정하는 데 문제가 있습니까?

  9. 9

    Netbeans 및 Maven, 종속 프로젝트로 정리 및 빌드

  10. 10

    빈 Maven 프로젝트를 설치할 수 없습니다.

  11. 11

    Eclipse 버전 : Mars.2 (4.5.2)에 Maven 프로젝트 설치

  12. 12

    Xamarin 프로젝트 설정

  13. 13

    Maven : 프로젝트 사본 이름 지정

  14. 14

    neatbeans maven javafx 프로젝트를 위해 Maven을 잘 설치하는 방법

  15. 15

    Maven 프로젝트의 특정 테스트로 Jenkins 병렬 테스트

  16. 16

    Intellij IDEA 2019.2 : 모든 프로젝트에 대해 Maven 홈 디렉토리를 "전역 적으로"설정

  17. 17

    Maven 프로젝트에서 기본 매개 변수를 설정하는 방법은 무엇입니까?

  18. 18

    Maven의 모든 프로젝트에 대한 기본 배포를 설정할 수 있나요?

  19. 19

    javaCV Maven 프로젝트

  20. 20

    셀레늄에서 특정 테스트 실행 (Eclipse IDE의 Maven 프로젝트)

  21. 21

    Maven 빌드 프로젝트를 설치하는 방법은 무엇입니까?

  22. 22

    Maven 프로젝트 패키징은 전쟁이지만 jar 빌드 / 설치

  23. 23

    프로젝트 바로 아래에 'Maven Dependencies'폴더 아래에 Maven 종속성이 나열되는 Eclipse 프로젝트를 어떻게 수정합니까?

  24. 24

    Maven 프로젝트에서 VS Code 시작을위한 projectName 결정

  25. 25

    Maven은 mutil 모듈 Maven 프로젝트에서 설치 (패키지) 전에 컴파일해야합니다.

  26. 26

    WPF 설정 Deplyoment 프로젝트

  27. 27

    LibGDX 프로젝트 설정시 오류

  28. 28

    Symfony 2.4 기본 프로젝트 설정

  29. 29

    gitlab의 기본 프로젝트 설정

뜨겁다태그

보관