开发者

maven-install-plugin: Can i define a custom packaging type but get the artifact installed as jar in the repo?

I am trying to come out with a plugin to detect and process Java 开发者_Python百科EE application clients.

I created a new packaging type called 'car' through META-INF/plexus/components.xml (http://maven-car-plugin.googlecode.com/svn/trunk/maven-car-plugin/src/main/resources/META-INF/plexus/components.xml) and a corresponding mojo for Java EE app clients. I have pretty much followed the same steps as the maven-ejb-plugin.

The behaviour i want is the same as the maven-ejb-plugin: Defines an ejb packaging type but the artifact gets installed in the repo as a .jar and gets bundled in the ear as .jar too.

I believe must be configurable some how because ejb packaging type gets installed as .jar but war packaging type produces a .war.

The problem in my case is that a .car file gets installed in the repo and a .car file gets bundled in the ear.

Does anyone know how to make sure it gets installed in the repo as a .jar file?


I ran into the same issue you have, except, I'm building a .war file and wanted a .jar file installed into my local repo. What I did was use the maven-jar-plugin to create a jar file in addition to a war file, it's generated in my /target directory. I also used the maven-install-plugin to install the outputted jar to my local repo.

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
            <execution>
                <id>make-jar</id>
                <phase>compile</phase>
                <goals>
                        <goal>jar</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-install-plugin</artifactId>
        <executions>
            <execution>
                <id>install-jar</id>
                <phase>install</phase>
                <goals>
                    <goal>install-file</goal>
                </goals>
                <configuration>
                    <packaging>jar</packaging>
                    <artifactId>${project.artifactId}</artifactId>
                    <groupId>${project.groupId}</groupId>
                    <version>${project.version}</version>
                    <file>${project.build.directory}/${project.artifactId}.jar</file>
                </configuration>
            </execution>
        </executions>
    </plugin>


Perhaps you could try using the packaging parameter in maven install plugin to see if that helps in your case?


I would assume you would have to specify

<packaging>jar</packaging>

as well in the component descriptor. Otherwise it looks correct to me..

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜