开发者

Attach a different packaging of a maven artifact to a deploy?

My maven build is creating an apklib package. I've added the jar plugin so that it also creates a JAR after generating sources and compiling. I'd like both the jar and apklib files to end up in our repository, so I'd like to attach both artifacts to the deploy and install.

I see that a similar question has been answered before, but that deals with an arbitrary file on the file system, not the dynamically-changing name of the artifact generated by the buil开发者_高级运维d process.


This is an answer, but I wish it were easier:

http://muralikashaboina.sys-con.com/node/419727/mobile (search for attaching additional artifacts)


By default the jar plugin will attach the artifact to the execution, replacing the default output. However you can configure it to attach an additional artifact instead by specifying the classifier in the jar-plugin's configuration.

This configuration below created an additional jar artifact which is automatically attached to the project and installed/deployed along with the main artifact. It is distinguished with the classifier api and includes only those classes that match the includes pattern.

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-jar-plugin</artifactId>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>jar</goal>
      </goals>
      <configuration>
        <classifier>api</classifier>
        <includes>
          <include>**/api/*</include>
        </includes>
      </configuration>
    </execution>
  </executions>
</plugin>


I have a feeling this might be fixed by now but if not please file a request for enhancement and potentially provide a patch that fixes it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜