You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jordan Zimmerman <jo...@jordanzimmerman.com> on 2014/03/05 14:50:00 UTC

Deploying archetypes

Hello,

I’d like to configure my project to auto-deploy my generated archetype as part of the deploy execution. Is there a way to do this? So, to create the archetype, I have this:

            <plugin>
                <artifactId>maven-archetype-plugin</artifactId>
                <configuration>
                    <propertyFile>archetype.properties</propertyFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>create-from-project</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Is there a way to configure the deploy plugin (or some other plugin) to run a “deploy” goal on the generated archetype (in target/generated-sources/archetype/target)?

Thanks!

-Jordan



Re: Deploying archetypes

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
Wow - looks like I’m on the cutting edge. It seems the NPE is fixed in 2.9 of the deploy plugin which isn’t released yet:

https://jira.codehaus.org/browse/MDEPLOY-174


From: Jordan Zimmerman jordan@jordanzimmerman.com
Reply: Jordan Zimmerman jordan@jordanzimmerman.com
Date: March 6, 2014 at 4:46:37 AM
To: Maven Users List users@maven.apache.org
Subject:  Re: Deploying archetypes  

The archetype is packaging already. The only problem is the deploy. Maintaining the generated archetype by hand is out of the question and defeats the purpose of the archetype. This is a sample/base application that is in constant development. The archetype needs to be up-to-date with any changes. 

The maddening thing is that I’m able to install the archetype just fine via:

            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/generated-sources/archetype/target/platform-sample-app-archetype-${project.version}.jar</file>
                            <pomFile>${project.build.directory}/generated-sources/archetype/pom.xml</pomFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

However, doing this same thing with deploy generates an NPE exception:

            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/generated-sources/archetype/target/platform-sample-app-archetype-${project.version}.jar</file>
                            <pomFile>${project.build.directory}/generated-sources/archetype/pom.xml</pomFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default) on project platform-sample-app: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default) on project platform-sample-app: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.lang.NullPointerException
at org.apache.maven.artifact.repository.MavenArtifactRepository.protocol(MavenArtifactRepository.java:218)
at org.apache.maven.artifact.repository.MavenArtifactRepository.<init>(MavenArtifactRepository.java:79)
at org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory.createArtifactRepository(DefaultArtifactRepositoryFactory.java:129)
at org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory.createDeploymentArtifactRepository(DefaultArtifactRepositoryFactory.java:78)
at org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory.createDeploymentArtifactRepository(DefaultArtifactRepositoryFactory.java:67)
at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:233)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
... 20 more


From: Hervé BOUTEMY herve.boutemy@free.fr
Reply: Maven Users List users@maven.apache.org
Date: March 6, 2014 at 2:20:03 AM
To: Maven Users List users@maven.apache.org
Subject:  Re: Deploying archetypes

befaore deploying, you'll have to package, which usually attaches the artifact
for later automatic deployment by deploy plugin
see http://maven.apache.org/archetype/maven-archetype-plugin/
and the maven-archetype packaging automating it
http://maven.apache.org/archetype/archetype-packaging/


but IMHO, trying to both generate an archetype, package it and deploy it from
the example project is a risky process, because your (example project) pom
will mix configuration for archetype generation/deployment with the valuable
configuration you intend to have in the archetype

you really should use create-from-project once then maintain the generated
archetype project (and in fact the generic example project in
src/main/resources)

Regards,

Hervé

Le mercredi 5 mars 2014 08:50:00 Jordan Zimmerman a écrit :
> Hello,
>
> I’d like to configure my project to auto-deploy my generated archetype as
> part of the deploy execution. Is there a way to do this? So, to create the
> archetype, I have this:
>
> <plugin>
> <artifactId>maven-archetype-plugin</artifactId>
> <configuration>
> <propertyFile>archetype.properties</propertyFile>
> </configuration>
> <executions>
> <execution>
> <phase>package</phase>
> <goals>
> <goal>create-from-project</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
>
> Is there a way to configure the deploy plugin (or some other plugin) to run
> a “deploy” goal on the generated archetype
> (in target/generated-sources/archetype/target)?
>
> Thanks!
>
> -Jordan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Deploying archetypes

Posted by Jordan Zimmerman <jo...@jordanzimmerman.com>.
The archetype is packaging already. The only problem is the deploy. Maintaining the generated archetype by hand is out of the question and defeats the purpose of the archetype. This is a sample/base application that is in constant development. The archetype needs to be up-to-date with any changes. 

The maddening thing is that I’m able to install the archetype just fine via:

            <plugin>
                <artifactId>maven-install-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>install-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/generated-sources/archetype/target/platform-sample-app-archetype-${project.version}.jar</file>
                            <pomFile>${project.build.directory}/generated-sources/archetype/pom.xml</pomFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

However, doing this same thing with deploy generates an NPE exception:

            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy-file</goal>
                        </goals>
                        <configuration>
                            <file>${project.build.directory}/generated-sources/archetype/target/platform-sample-app-archetype-${project.version}.jar</file>
                            <pomFile>${project.build.directory}/generated-sources/archetype/pom.xml</pomFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default) on project platform-sample-app: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file (default) on project platform-sample-app: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed.
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default of goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file failed.
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
	... 19 more
Caused by: java.lang.NullPointerException
	at org.apache.maven.artifact.repository.MavenArtifactRepository.protocol(MavenArtifactRepository.java:218)
	at org.apache.maven.artifact.repository.MavenArtifactRepository.<init>(MavenArtifactRepository.java:79)
	at org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory.createArtifactRepository(DefaultArtifactRepositoryFactory.java:129)
	at org.apache.maven.repository.legacy.repository.DefaultArtifactRepositoryFactory.createDeploymentArtifactRepository(DefaultArtifactRepositoryFactory.java:78)
	at org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory.createDeploymentArtifactRepository(DefaultArtifactRepositoryFactory.java:67)
	at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:233)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
	... 20 more


From: Hervé BOUTEMY herve.boutemy@free.fr
Reply: Maven Users List users@maven.apache.org
Date: March 6, 2014 at 2:20:03 AM
To: Maven Users List users@maven.apache.org
Subject:  Re: Deploying archetypes  

befaore deploying, you'll have to package, which usually attaches the artifact  
for later automatic deployment by deploy plugin  
see http://maven.apache.org/archetype/maven-archetype-plugin/  
and the maven-archetype packaging automating it  
http://maven.apache.org/archetype/archetype-packaging/  


but IMHO, trying to both generate an archetype, package it and deploy it from  
the example project is a risky process, because your (example project) pom  
will mix configuration for archetype generation/deployment with the valuable  
configuration you intend to have in the archetype  

you really should use create-from-project once then maintain the generated  
archetype project (and in fact the generic example project in  
src/main/resources)  

Regards,  

Hervé  

Le mercredi 5 mars 2014 08:50:00 Jordan Zimmerman a écrit :  
> Hello,  
>  
> I’d like to configure my project to auto-deploy my generated archetype as  
> part of the deploy execution. Is there a way to do this? So, to create the  
> archetype, I have this:  
>  
> <plugin>  
> <artifactId>maven-archetype-plugin</artifactId>  
> <configuration>  
> <propertyFile>archetype.properties</propertyFile>  
> </configuration>  
> <executions>  
> <execution>  
> <phase>package</phase>  
> <goals>  
> <goal>create-from-project</goal>  
> </goals>  
> </execution>  
> </executions>  
> </plugin>  
>  
> Is there a way to configure the deploy plugin (or some other plugin) to run  
> a “deploy” goal on the generated archetype  
> (in target/generated-sources/archetype/target)?  
>  
> Thanks!  
>  
> -Jordan  


---------------------------------------------------------------------  
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org  
For additional commands, e-mail: users-help@maven.apache.org  


Re: Deploying archetypes

Posted by Hervé BOUTEMY <he...@free.fr>.
befaore deploying, you'll have to package, which usually attaches the artifact 
for later automatic deployment by deploy plugin
see http://maven.apache.org/archetype/maven-archetype-plugin/
and the maven-archetype packaging automating it
http://maven.apache.org/archetype/archetype-packaging/


but IMHO, trying to both generate an archetype, package it and deploy it from 
the example project is a risky process, because your (example project) pom 
will mix configuration for archetype generation/deployment with the valuable 
configuration you intend to have in the archetype

you really should use create-from-project once then maintain the generated 
archetype project (and in fact the generic example project in 
src/main/resources)

Regards,

Hervé

Le mercredi 5 mars 2014 08:50:00 Jordan Zimmerman a écrit :
> Hello,
> 
> I’d like to configure my project to auto-deploy my generated archetype as
> part of the deploy execution. Is there a way to do this? So, to create the
> archetype, I have this:
> 
>             <plugin>
>                 <artifactId>maven-archetype-plugin</artifactId>
>                 <configuration>
>                     <propertyFile>archetype.properties</propertyFile>
>                 </configuration>
>                 <executions>
>                     <execution>
>                         <phase>package</phase>
>                         <goals>
>                             <goal>create-from-project</goal>
>                         </goals>
>                     </execution>
>                 </executions>
>             </plugin>
> 
> Is there a way to configure the deploy plugin (or some other plugin) to run
> a “deploy” goal on the generated archetype
> (in target/generated-sources/archetype/target)?
> 
> Thanks!
> 
> -Jordan


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org