2

음영 처리 된 인공물이있는 다중 모듈 프로젝트를 출시하려고합니다. 릴리스를 실행하는 경우 : 준비 후 릴리스 : Nexus 리포지토리에 업로드 된 아티팩트는 음영 처리 된 것이 아니라 원본 Jar 만 포함합니다.maven-release-plugin에는 회색 음영이 포함되어 있지 않습니다.

"패키지"라이프 사이클 이전에 Maven "릴리스"가 실행될 수 있습니까?

내가 실행 해요 명령은 다음과 같습니다

mvn release:prepare --batch-mode -Dtag=myproject-1.2.0.0000 -DreleaseVersion=1.2.0 -DdevelopmentVersion=1.2.0 -DremoteTagging=false -DsuppressCommitBeforeTag=true -Dresume=false 

내 부모의 pom.xml은 다음과 같습니다

<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> 
<name>myproject</name> 
<groupId>org.my.project</groupId> 
<artifactId>my-project-parent</artifactId> 
<version>1.2.0-SNAPSHOT</version> 
<packaging>pom</packaging> 
<description>myproject</description> 

<modules> 
    <module>module1</module> 
    <module>module2</module> 
    <module>distribution</module> 
</modules> 
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.5.1</version> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 

    </plugins> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-source-plugin</artifactId> 
       <version>2.2.1</version> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>2.0</version> 
      </plugin> 
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <version>2.3</version> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-failsafe-plugin</artifactId> 
       <version>2.12.3</version> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 
<dependencyManagement> 
    <dependencies> 
     <!-- self-dependencies --> 
     <dependency> 
      <groupId>org.my.project</groupId> 
      <artifactId>module1</artifactId> 
      <version>${project.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.my.project</groupId> 
      <artifactId>module2</artifactId> 
      <version>${project.version}</version> 
     </dependency> 
    </dependencies> 
</dependencyManagement> 
<profiles> 
    <profile> 
     <id>development</id> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
    </profile> 
</profiles> 

배포 프로젝트의 pom.xml 파일은

처럼 보인다
<?xml version="1.0" encoding="UTF-8"?> 

http : // maven .apache.org/XSD/받는다는-4.0.0.xsd "> 내 프로젝트 - 부모 org.my.project 1.2.0-SNAPSHOT 4.0.0

<artifactId>distribution</artifactId> 
     <dependencies> 
      <dependency> 
       <groupId>org.my.project</groupId> 
       <artifactId>module1</artifactId> 
       <version>${project.version}</version> 
      </dependency> 

      <dependency> 
       <groupId>org.my.project</groupId> 
       <artifactId>module2</artifactId> 
       <version>${project.version}</version> 
      </dependency>     
     </dependencies> 
     <build> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-shade-plugin</artifactId> 
        <executions> 
         <execution> 
          <phase>prepare-package</phase> 
          <goals> 
           <goal>shade</goal> 
          </goals> 
          <configuration> 
           <outputFile>${project.build.directory}/myproject-${project.version}.jar</outputFile> 
           <createSourcesJar>true</createSourcesJar> 
           <filters> 
            <filter> 
             <artifact>*:*</artifact> 
             <excludes> 
              <exclude>log4j.xml</exclude> 
             </excludes> 
            </filter> 
           </filters> 
           <artifactSet> 
            <includes> 
             <include>org.my.project:module*</include> 
            </includes> 
           </artifactSet> 
          </configuration> 
         </execution> 
        </executions> 
       </plugin> 
      </plugins> 
     </build> 

내 컴퓨터의 폴더에 음영 처리 된 이슈가 있지만 Nexus 저장소의 아티팩트가 원래 빈 Jar 만 처리합니다.

그림자가있는 병을 움켜 쥐게하는 방법이 있습니까?

감사합니다, Eyal 님

답변

1

당신은 받는다는 그늘 - 플러그 인 구성에 태그 <shadedArtifactAttached>true</shadedArtifactAttached>를 추가 할 수 있습니다.

+0

안녕하세요 기룸, 고마워요! 이것은 내 문제를 해결했다. 그러나 음영 처리 된 이슈의 이름을 변경하려면 태그를 사용하고 있습니다. 이 태그는 를 무시합니다. 음영 플러그인의 실행을 이름이 지정된 방식으로 이름이 지정된 프로젝트로 옮긴 다음 태그가 필요없고 대신 태그를 사용했습니다. –

관련 문제