I may be talking out a hole but check this out...

The release version along with version range information comes from metadata... 
if you created your internal repository in a way other than using the deploy 
plugin then you won't have metadata. If you are copying your local repository 
aka the artifact cache then you don't have 'maven-metadata.xml' in the correct 
place. you have cache copies of the metadata named central-maven-metadata.xml...

if you only used central to build your local cache then you could just rename 
centra-maven-metadata... or you could just use a repository manager given you 
seem to have the requirement for it.

hope that helps..

On Mon, 19 Jan 2009 07:46:18 Ross B wrote:
> 
> Hello,
> 
>  
> I'm having difficulties getting the maven-archetype-plug-in to work with an 
> internal repository. The problem seems to be that it cannot locate the 
> RELEASE version of this plugin when given an internal repository. I've copied 
> the error I get to the end of this email together with my settings.xml file. 
> I have tried various configurations and workarounds. I have maven configured 
> to <mirrorOf>*</mirrorOf> which points to my internal repo and I have tried 
> combining this with a profile that uses this mirror for a <pluginRepository> 
> to no avail. The only workaround which works for me is to specify the fully 
> qualified archetype command which locks down the version of both the 
> archetype plugin and the archetype rather than using the metadata to 
> determine the RELEASE versions:
>  
> e.g.
>  
> mvn org.apache.maven.plugins:maven-archetype-plugin:2.0-alpha-4:create 
> -DartifactId=new-proj -DgroupId=org.mycompany -DpackageId=org.mycompany 
> -DarchetypeVersion=1.0
>  
> This is executed in a directory that does not have a pom.xml file. I can get 
> the list of available archetypes from the generate goal if I execute mvn 
> archetype:generate in a directory that has a pom.xml, which defines the 
> plugin and its version as a build dependency, but then it bombs out when I 
> select an archetype because it cannot find the RELEASE version of that 
> archetype (even though it exists in the internal repo).
>  
> Now, as far as I can see, the metadata in my internal repository matches the 
> metadata in central so I'm struggling to see what's going wrong. I should 
> note that my internal repository is generated by running the archetype and 
> other plugins in an environment with access to central and then I copy the 
> local repo from .m2 into another folder which acts as an internal repository. 
> Does this method not provide appropriate metadata, or is Maven for some 
> reason always going to Central to determine the release version of this 
> plugin?  I should note that I have also tried the 
> -DremoteRepositories=file://<local-repo-dir> flag but this doesn't seem to 
> have much effect.
>  
> This behavior is consistent in Maven 2.0.9/Archetype plugin 2.0-alpha-4 and 
> Maven 2.1.0-M1. I have read various FAQs and bug reports about this being 
> fixed but I'm still having difficulties so I'd be grateful for some 
> suggestions or a working configuration.
>  
> Here's the config I've tried thus far:
>  
> My settings.xml (I get the same failure case when the profile is switched off 
> or commented and have tried both direct/indirect urls in the profile 
> repository <url>'s):
>  
> <mirror>      <id>mirrorId</id>      <mirrorOf>*</mirrorOf>      <name>Human 
> Readable Name for this Mirror.</name>            
> <url>file://C:/<local-repo-dir></url>
> </mirror>
>  
> <profile>      <id>internal-repo</id>      <repositories>        <repository> 
>           <id>central-repo</id>           <url>http://dummy-url</url>         
>   <!-- <url>file:///C:/<local-repo-dir></url> -->           <releases>        
>        <enabled>true</enabled>               <updatePolicy/>               
> <checksumPolicy/>           </releases>           <snapshots>              
> <enabled>true</enabled>              <updatePolicy/>              
> <checksumPolicy/>           </snapshots>           <layout/>         
> </repository>      </repositories>            <pluginRepositories>       
> <pluginRepository>         <id>central-plugin-repo</id>          
> <url>http://dummy-url</url>           <!-- 
> <url>file:///C:/<local-repo-dir></url> -->           <releases>               
>  <enabled>true</enabled>                <updatePolicy/>                
> <checksumPolicy/>           </releases>           <snapshots>                
> <enabled>true</enabled>                <updatePolicy/>                
> <checksumPolicy/>            </snapshots>             <layout/>       
> </pluginRepository>      </pluginRepositories>    </profile>   
>  
> Here's the error:
>  
> ----------------------------------
>  
> [INFO] Scanning for projects...[INFO] Searching repository for plugin with 
> prefix: 'archetype'.[DEBUG] Loading plugin prefixes from group: 
> org.apache.maven.plugins[INFO] org.apache.maven.plugins: checking for updates 
> from central-plugin-repo[DEBUG] repository metadata for: 
> 'org.apache.maven.plugins' could not be found on repository: 
> central-plugin-repo[INFO] org.apache.maven.plugins: checking for updates from 
> central[DEBUG] repository metadata for: 'org.apache.maven.plugins' could not 
> be found on repository: central[DEBUG] Loading plugin prefixes from group: 
> org.codehaus.mojo[INFO] org.codehaus.mojo: checking for updates from 
> central-plugin-repo[DEBUG] repository metadata for: 'org.codehaus.mojo' could 
> not be found on repository: central-plugin-repo[INFO] org.codehaus.mojo: 
> checking for updates from central[DEBUG] repository metadata for: 
> 'org.codehaus.mojo' could not be found on repository: central[INFO] artifact 
> org.apache.maven.plugins:maven-archetype-plugin: checking for updates from 
> central-plugin-repo[DEBUG] repository metadata for: 'artifact 
> org.apache.maven.plugins:maven-archetype-plugin' could not be found on 
> repository: central-plugin-repo[INFO] artifact 
> org.apache.maven.plugins:maven-archetype-plugin: checking for updates from 
> central[DEBUG] repository metadata for: 'artifact 
> org.apache.maven.plugins:maven-archetype-plugin' could not be found on 
> repository: central[DEBUG] maven-archetype-plugin: using locally installed 
> snapshot[DEBUG] Artifact not found - using stub model: Unable to determine 
> the latest version
>  
>   org.apache.maven.plugins:maven-archetype-plugin:pom:LATEST
>  
> [DEBUG] Using defaults for missing POM 
> org.apache.maven.plugins:maven-archetype-plugin:pom:LATEST[DEBUG] 
> maven-archetype-plugin: using locally installed snapshot[DEBUG] Artifact not 
> found - using stub model: Unable to determine the release version
>  
>   org.apache.maven.plugins:maven-archetype-plugin:pom:RELEASE
>  
> [DEBUG] Using defaults for missing POM 
> org.apache.maven.plugins:maven-archetype-plugin:pom:RELEASE[INFO] 
> ------------------------------------------------------------------------[ERROR]
>  BUILD ERROR[INFO] 
> ------------------------------------------------------------------------[INFO]
>  The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist 
> or no valid version could be found[INFO] 
> ------------------------------------------------------------------------[DEBUG]
>  Traceorg.apache.maven.lifecycle.LifecycleExecutionException: The plugin 
> 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid 
> version could be found        at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1303)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.getMojoDescriptor(DefaultLifecycleExecutor.java:1542)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.segmentTaskListByAggregationNeeds(DefaultLifecycleExecutor.java:405)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:137)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)     
>    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)        at 
> org.apache.maven.cli.MavenCli.main(MavenCli.java:287)        at 
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)        at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>        at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)        at 
> org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)        at 
> org.codehaus.classworlds.Launcher.launch(Launcher.java:255)        at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)        
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)Caused by: 
> org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 
> 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid 
> version could be found        at 
> org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:229)
>         at 
> org.apache.maven.plugin.version.DefaultPluginVersionManager.resolvePluginVersion(DefaultPluginVersionManager.java:91)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.verifyPlugin(DefaultPluginManager.java:171)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.verifyPlugin(DefaultLifecycleExecutor.java:1274)
>         ... 14 more[INFO] 
> ------------------------------------------------------------------------[INFO]
>  Total time: < 1 second[INFO] Finished at: Sat Jan 17 12:09:10 GMT 2009[INFO] 
> Final Memory: 2M/30M[INFO] 
> ------------------------------------------------------------------------
>  
> ---------------------------------------------------
>  
> In my local repository within the 
> .m2\repository\org\apache\maven\plugins\maven-archetype-plugin directory, 
> Maven creates two files for both of the repositories in the profile, here's 
> the output for maven-metadata-central-plugin-repo.xml (this output is 
> identical in the other xml file):
>  
> <?xml version="1.0" encoding="UTF-8"?><metadata>  
> <groupId>org.apache.maven.plugins</groupId>  
> <artifactId>maven-archetype-plugin</artifactId></metadata>
>  
> In the directory above (.m2\repository\org\apache\maven\plugins) the same xml 
> file is generated with this output:
>  
> <?xml version="1.0" encoding="UTF-8"?><metadata />
>  
>  
> I'd be most grateful for any comments because while I have something working, 
> it would be more comforting to have it working in a manner where it can 
> determine the RELEASE version automatically from my internal repository.
>  
> Regards,
>  
> Ross.
> _________________________________________________________________
> Cut through the jargon: find a PC for your needs.
> http://clk.atdmt.com/UKM/go/130777504/direct/01/



-- 
Michael McCallum
Enterprise Engineer
mailto:gho...@apache.org

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

Reply via email to