Ответ 1
Чтобы сделать то, что вы описали, создайте проект Maven с упаковкой jar (как указано здесь, так как там 't быть определениями mojo). В подпапке src/main/resources/META-INF/plexus создайте файл component.xml со следующим содержимым (если вы хотите, чтобы тип упаковки был "my-custom-type", измените его на "foobar", если вы по желанию).
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>my-custom-type</role-hint>
<implementation>
org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
</implementation>
<configuration>
<phases>
<!--use the basic jar lifecycle bindings, add additional
executions in here if you want anything extra to be run-->
<process-resources>
org.apache.maven.plugins:maven-resources-plugin:resources
</process-resources>
<package>
org.apache.maven.plugins:maven-jar-plugin:jar
</package>
<install>
org.apache.maven.plugins:maven-install-plugin:install
</install>
<deploy>
org.apache.maven.plugins:maven-deploy-plugin:deploy
</deploy>
</phases>
</configuration>
</component>
<component>
<role>org.apache.maven.artifact.handler.ArtifactHandler</role>
<role-hint>my-custom-type</role-hint>
<implementation>
org.apache.maven.artifact.handler.DefaultArtifactHandler
</implementation>
<configuration>
<!--the extension used by Maven in the repository-->
<extension>foobar</extension>
<!--the type used when specifying dependencies etc.-->
<type>my-custom-type</type>
<!--the packaging used when declaring an implementation of
the packaging-->
<packaging>my-custom-type</packaging>
</configuration>
</component>
</components>
</component-set>
Затем в помпе, которая должна иметь пользовательскую упаковку, объявите требуемый тип в упаковочном элементе и убедитесь, что вы указали плагин, чтобы пользовательская упаковка могла быть внесена. Объявление <extensions> true </extensions> сообщает Maven, что плагин вносит вклад в упаковку и/или типы обработчиков в Maven.
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>name.seller.rich</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>my-custom-type</packaging>
<build>
<plugins>
<plugin>
<groupId>name.seller.rich.maven.plugins</groupId>
<artifactId>maven-foobar-plugin</artifactId>
<version>0.0.1</version>
<!--declare that this plugin contributes the component extensions-->
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Когда проект будет упакован, он будет банкой с расширением .jar, однако, когда он будет установлен/развернут, Maven будет доставлять файл в репозиторий с расширением ".foobar", как указано в компонентах .xml