나는 초보자입니다 ... 누군가가 도울 수 있습니다.
다른 모듈에서 모듈을 시작할 수 있습니까?
예를 들면 :
내 모듈 : F-Frontend, B-Backend
이제 부두를 통해 프런트 엔드 모듈을 시작하지만 백엔드 기능이 필요하고 백엔드 모듈도 실행해야합니다.
가능합니까? 어떤 아이디어?
고마워
추신. intelliJ를 사용하고 있습니다
부모 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.xxx.maven</groupId>
<artifactId>project-name</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>project-name-parent</name>
...
프런트 엔드 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">
<parent>
<artifactId>project-name</artifactId>
<groupId>com.xxx.maven</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>project-name-frontend</artifactId>
...
<dependency>
<groupId>com.xxx.maven</groupId>
<artifactId>project-name-backend</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
백엔드 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">
<parent>
<artifactId>project-name</artifactId>
<groupId>com.xxx.maven</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>project-name-backend</artifactId>
<packaging>jar</packaging>
...
업데이트 2 mvn 배포 백엔드 후.
[WARNING] The POM for com.xxx.maven:project-name-backend:jar:1.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.285s
[INFO] Finished at: Wed Sep 09 15:45:13 CEST 2015
[INFO] Final Memory: 13M/304M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project project-name-cmf-frontend: Could not resolve dependencies for project com.xxx.maven:project-name-frontend:jar:1.0-SNAPSHOT: Failure to find com.xxx.maven:project-name-backend:jar:1.0-SNAPSHOT in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Maven 모듈은 별도의 애플리케이션이 아닙니다. 재사용 성을 위해 다른 모듈을 사용하여 애플리케이션의 다른 부분을 다른 Jar로 지정할 수 있습니다.
실제로 시작하는 것은 응용 프로그램 (또는 전쟁 등)입니다. 프로젝트가 해당 jar를 가져 와서 서브 모듈에 링크 할 수있는 곳.
parent pom은 빌드 할 모듈을 호출해야합니다 (부모의 pom.xml 위치에서 실행되어야합니다.
<modules>
<module>front-end</module>
<module>back-end</module>
</modules>
그렇다면 pom.xml을 통해 다른 항아리를 가져 오는 것을 의미합니까? jetty-maven-plugin Pom.xml
에 대한 자세한 내용은 다음과 같습니다.
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>parent.project</groupId>
<artifactId>artifact</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>group_id</groupId>
<artifactId>artifact_id</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
...<!-- add plugin for mvn jetty:run (check the name to match your project name) -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.3.1-SNAPSHOT</version>
<configuration>
<war>${project.basedir}/target/mycustom.war</war>
</configuration>
</plugin>
</plugins>
</build>
</project>
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다