Maven + m2eclipse와 함께 SpringSource Tool Suite (STS)를 사용합니다. 최신 프로젝트에서 SVN에서 STS로 정확하게 기존 Maven 프로젝트를 가져 오는 문제에 직면하고 있습니다. 내가 import -> Maven -> 'existing Maven project'
를 사용하는 경우, 프로젝트가 가져옵니다하지만 다음과 같은 문제가됩니다왜 STS/m2eclipse가 내 Maven 종속성을 추적하지 않습니까?
src/main/java
및src/test/java
소스 폴더로 포착되지 않습니다. STS는src
을 원본 폴더로 구성하고 main/test가 패키지 이름에 추가됩니다.- Maven 종속성 라이브러리가 Java 빌드 경로에 추가되지 않습니다.
나는 수동으로 소스 폴더를 수정할 수 있지만 추가하려고 할 때 나는 '메이븐 의존성 해상도를 구성하는 Maven을 사용하여 프로젝트 설정'는 메시지가 빌드 경로에 라이브러리 'Maven은 의존성 관리'를하고 라이브러리입니다 추가되지 않았습니다. 내가 설정할 수있는 유일한 Maven 프로젝트 설정은 활성 프로파일과 '작업 공간 프로젝트의 종속성 해결'(확인 됨)이며, 어느 것도 차이가없는 것으로 보입니다. 내가 명령 줄에서 mvn install
을 실행하면
프로젝트를 성공적으로 구축합니다. mvn eclipse:eclipse
을 실행 한 후 STS로 가져 오면 예상대로 작동하지만, pom을 업데이트 할 때마다이 작업을 다시 실행해야합니다. 이는 바람직하지 않습니다.
mvn eclipse:eclipse
를 실행 한 후 수동으로
M2_REPO
의존성이
eclipse:eclipse
추가 제거 .classpath를 업데이트하고 m2eclipse에 종속 항목을 추가하여 해결할 :
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
그럼 난 기존 수입 Maven 프로젝트를 예상대로 일했다 . 그러나 이것은 해킹이며 m2eclipse로 작업 할 때 eclipse:ecplise
이 실행되는 다른 결과가 무엇인지 확신 할 수 없습니다.
다른 maven 프로젝트에서 작업했으며 제대로 가져 오는 데 문제가 없었습니다.
아마 관련 정보 :
- 이것은 웹 애플리케이션 프로젝트입니다.
- subversion repo에는
pom.xml
및src
폴더 만 포함됩니다. - 외부 메이븐 설치를 사용하며 버전 3.0입니다.다음 Maven 프로젝트를
- 가져 오기 프로젝트를 기존의 가져 오기를 사용하여 STS에 가져
- 다운로드 SVN에서 로컬 디스크 :
- 3 우리는 내가 시도 것들 유물 다운로드
에 대한 현장 Artifactory의 REPO를 사용 SVN에서 STS로 설정 -> Maven 속성 사용
- 실행
mvn eclipse:eclipse
다음 가져 오기 (작동하지만 m2e에 대한 수동 클래스 경로 편집 필요) - Search stackoverflow, this question은 매우 비슷하지만 답변이 내 문제를 해결하지 못하는 것 같습니다.
의 pom.xml :
- 가 m2eclipse에 가져 오기가 제대로 작동하도록 :이
<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.company.group</groupId> <artifactId>artifact</artifactId> <version>1.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>My Project</name> <description>My Project</description> <properties> <java-version>1.6</java-version> <org.springframework-version>3.1.0.RELEASE</org.springframework-version> <!-- Lots of other versions omitted --> </properties> <repositories> <repository> <id>repoId</id> <name>repoName</name> <url>http://fake.company.com/artifactory/repo</url> <layout>default</layout> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>repoId</id> <name>repoName</name> <url>http://fake.company.com/artifactory/repo</url> </pluginRepository> </pluginRepositories> <!-- Configurations required for deploy plugin. Artifacts are deployed to artifactory --> <distributionManagement> <repository> <id>repoId</id> <name>repoName-releases</name> <url>http://fake.company.com/artifactory/apps-releases-local</url> </repository> <snapshotRepository> <id>repoId</id> <name>repoName-snapshots</name> <url>http://fake.company.com/artifactory/apps-snapshots-local</url> </snapshotRepository> </distributionManagement> <scm> <connection>scm:svn:https://fake.company.com/svn/fake-repo/trunk</connection> <developerConnection>scm:svn:https://fake.company.com/svn/fake-repo/trunk</developerConnection> <url>https://fake.company.com/svn/fake-repo/trunk</url> </scm> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${org.springframework-version}</version> </dependency> <!-- Lots of other dependencies omitted --> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <excludes> <exclude>**/TestUtil.java</exclude> </excludes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <verbose>true</verbose> <source>${java-version}</source> <target>${java-version}</target> <compilerVersion>${java-version}</compilerVersion> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <warName>war-name</warName> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>install</id> <phase>install</phase> <goals> <goal>sources</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.1</version> <configuration> <formats> <format>html</format> </formats> <instrumentation> <ignores> <ignore>path/**/*Test.class</ignore> </ignores> <excludes> <exclude>path/Constants.class</exclude> <exclude>path/*.class</exclude> </excludes> </instrumentation> <check> <haltOnFailure>false</haltOnFailure> <totalBranchRate>25</totalBranchRate> <totalLineRate>41</totalLineRate> <packageLineRate>25</packageLineRate> <packageBranchRate>15</packageBranchRate> </check> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>cobertura</goal> <goal>check</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${org.apache.cxf-version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <configuration> <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl>${basedir}/src/main/resources/wsdl/automation.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> <goals> <goal>wsdl2java</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>1.7</version> <executions> <execution> <phase>generate-sources</phase> <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>target/generated/cxf</source> </sources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-eclipse-plugin</artifactId> <version>2.9</version> <configuration> <additionalProjectnatures> <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature> <projectnature>org.eclipse.jdt.groovy.core.groovyNature</projectnature> </additionalProjectnatures> <additionalBuildcommands> <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand> </additionalBuildcommands> </configuration> </plugin> </plugins> <pluginManagement> <plugins> <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. --> <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.cxf</groupId> <artifactId> cxf-codegen-plugin </artifactId> <versionRange> [${org.apache.cxf-version},) </versionRange> <goals> <goal>wsdl2java</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> <pluginExecution> <pluginExecutionFilter> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <versionRange>[2.3.2,)</versionRange> <goals> <goal>compile</goal> <goal>testCompile</goal> </goals> </pluginExecutionFilter> <action> <ignore /> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> </plugins> </pluginManagement> </build> <profiles> <!-- Deployment profiles omitted --> </profiles> </project>
사람이하는 방법에 대한 아이디어가 있습니까? OR
- 프로젝트 생성/변환 후 빌드 경로에 관리 대상 종속성을 추가 할 수 있도록 STS를 구성 하시겠습니까?
프로젝트에는 그루비 코드가 있지만 주로 자바입니다. groovy-eclipse-compiler를 사용하고 있습니다. – Marquee
나는 pom 빌드 플러그인 섹션에서 볼 수 있지만 다른 컴파일러에 대한 참조는 볼 수 없을 것으로 예상됩니다. (이것은 원래의 질문 범위를 벗어나므로 중요하지 않을 수 있습니다.) –
마침내 오늘 이것을 시험해 볼 수있는 기회가 있었고, 당신은 정확하게 맞습니다. pom에서 해당 부분을 제거하면 원하는대로 가져올 수있었습니다. 감사!! – Marquee