Maven Archetype

cannot create project based on archetype that is not in cetral repository

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

it's not possible to create an archetype based on a template from non-default repository. the archetype's artifact never gets downloaded.
I tried to create a project based on archetype from mevenide.codehaus.org/m2-repository (the repository is listed in the settings.xml file - the file is attached)
the command line looks like this:
m2 archetype:create -DgroupId=com.mycompany -DartifactId=myapp -DarchetypeGroupId=org.codehaus.mevenide.plugins -DarchetypeArtifactId=maven-archetype-nbm -DarchetypeVersion=1.0

The artifact is there: http://mevenide.codehaus.org/m2-repository/org/codehaus/mevenide/plugins/maven-archetype-nbm/
but the repository never gets contacted.

here is the output of the command:

----------------------------------------------------
THE m2 COMMMAND IS DEPRECATED - PLEASE RUN mvn INSTEAD

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ----------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:create] (aggregator-style)
[INFO] ----------------------------------------------------------------------------
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] **************************************************************
[INFO] Starting Jakarta Velocity v1.4
[INFO] RuntimeInstance initializing.
[INFO] Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[INFO] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[INFO] Resource Loader Instantiated: org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader
[INFO] ClasspathResourceLoader : initialization starting.
[INFO] ClasspathResourceLoader : initialization complete.
[INFO] ResourceCache : initialized. (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[INFO] Default ResourceManager initialization complete.
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[INFO] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[INFO] Created: 20 parsers.
[INFO] Velocimacro : initialization starting.
[INFO] Velocimacro : adding VMs from VM library template : VM_global_library.vm
[ERROR] ResourceManager : unable to find resource 'VM_global_library.vm' in anyresource loader.
[INFO] Velocimacro : error using VM library template VM_global_library.vm : org.apache.velocity.exception.ResourceNotFoundException: Unable to find resource 'VM_global_library.vm'
[INFO] Velocimacro : VM library template macro registration complete.
[INFO] Velocimacro : allowInline = true : VMs can be defined inline in templates
[INFO] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOTreplace previous VM definitions
[INFO] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[INFO] Velocimacro : messages on : VM system will output logging messages
[INFO] Velocimacro : autoload off : VM system will not automatically reload global library macros
[INFO] Velocimacro : initialization complete.
[INFO] Velocity successfully started.
[INFO] [archetype:create]
[INFO] Defaulting package to group ID: com.mycompany
Downloading: http://repo1.maven.org/maven2/org/codehaus/mevenide/plugins/maven-archetype-nbm/1.0/maven-archetype-nbm-1.0.jar
[WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2)
[INFO] ----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ----------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

GroupId: org.codehaus.mevenide.plugins
ArtifactId: maven-archetype-nbm
Version: 1.0

Reason: Unable to download the artifact from any repository
org.codehaus.mevenide.plugins:maven-archetype-nbm:1.0:jar

from the specified remote repositories:
central (http://repo1.maven.org/maven2)

[INFO] ----------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ----------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Oct 20 16:56:12 CEST 2005
[INFO] Final Memory: 4M/7M
[INFO] ----------------------------------------------------------------------------

Issue Links

Activity

Hide
Jason van Zyl added a comment -

I've created a work around fix whereby the user can specify a remote repository on the cli. I think there is still a problem if profiles aren't getting merged.

Show
Jason van Zyl added a comment - I've created a work around fix whereby the user can specify a remote repository on the cli. I think there is still a problem if profiles aren't getting merged.
Hide
Rob Dickens added a comment -

I just tried this workaround--$ mvn archetype:create -DremoteRepositories=file:///usr/local/mvnrep ...--but without success.

Show
Rob Dickens added a comment - I just tried this workaround--$ mvn archetype:create -DremoteRepositories=file:///usr/local/mvnrep ...--but without success.
Hide
Rob Dickens added a comment -

Okay, I just discovered that the workaround isn't yet in the released version of the plugin. (Many thanks to WS.)

Show
Rob Dickens added a comment - Okay, I just discovered that the workaround isn't yet in the released version of the plugin. (Many thanks to WS.)
Hide
Rob Dickens added a comment -

just tried to build the plugin from src, but got the following:

[INFO] Failed to resolve artifact.

required artifacts missing:
org.apache.maven.archetype:maven-archetype-creator:jar:0.7-SNAPSHOT
org.apache.maven.archetype:maven-archetype-core:jar:0.7-SNAPSHOT

for the artifact:
org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:0.7-SNAPSHOT

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
snapshots (http://snapshots.maven.codehaus.org/maven2),
internal-rep (http://repo2.maven.org/maven2)

Show
Rob Dickens added a comment - just tried to build the plugin from src, but got the following: [INFO] Failed to resolve artifact. required artifacts missing: org.apache.maven.archetype:maven-archetype-creator:jar:0.7-SNAPSHOT org.apache.maven.archetype:maven-archetype-core:jar:0.7-SNAPSHOT for the artifact: org.apache.maven.plugins:maven-archetype-plugin:maven-plugin:0.7-SNAPSHOT from the specified remote repositories: central (http://repo1.maven.org/maven2), snapshots (http://snapshots.maven.codehaus.org/maven2), internal-rep (http://repo2.maven.org/maven2)
Hide
Wendy Smoak added a comment -

Sorry, I was going to comment on this yesterday... to get to work, I built the whole archetype module, not just the plugin.

$ svn co https://svn.apache.org/repos/asf/maven/archetype/trunk archetype
$ cd archetype
$ mvn install

Here's proof that it does actually work: http://wiki.wsmoak.net/cgi-bin/wiki.pl?ShaleGettingStarted/Output

Notably, the lines:
[INFO] [archetype:create]
[INFO] We are using command line specified remote repositories: http://cvs.apache.org/maven-snapshot-repository
[INFO] snapshot struts:struts-archetype-shale-blank:1.0.1-SNAPSHOT: checking for updates from id0
Downloading: http://cvs.apache.org/maven-snapshot-repository/struts/struts-archetype-shale-blank/1.0.1-SNAPSHOT/struts-archetype-shale-blank-1.0.1-SNAPSHOT.jar
19K downloaded

Show
Wendy Smoak added a comment - Sorry, I was going to comment on this yesterday... to get to work, I built the whole archetype module, not just the plugin. $ svn co https://svn.apache.org/repos/asf/maven/archetype/trunk archetype $ cd archetype $ mvn install Here's proof that it does actually work: http://wiki.wsmoak.net/cgi-bin/wiki.pl?ShaleGettingStarted/Output Notably, the lines: [INFO] [archetype:create] [INFO] We are using command line specified remote repositories: http://cvs.apache.org/maven-snapshot-repository [INFO] snapshot struts:struts-archetype-shale-blank:1.0.1-SNAPSHOT: checking for updates from id0 Downloading: http://cvs.apache.org/maven-snapshot-repository/struts/struts-archetype-shale-blank/1.0.1-SNAPSHOT/struts-archetype-shale-blank-1.0.1-SNAPSHOT.jar 19K downloaded
Hide
Rob Dickens added a comment -

THAT builds, AND works (with the -DremoteRepositories=...). Thanks very much indeed.

Show
Rob Dickens added a comment - THAT builds, AND works (with the -DremoteRepositories=...). Thanks very much indeed.
Hide
Rob Dickens added a comment -

When I said it builds, I meant 'mvn install's (to your local repository). However, doing a 'mvn deploy' to your internal repository appears to require various changes (which I haven't been able to fathom). Also, repeating the 'mvn install' appears to require that you manually delete various target directories.

Show
Rob Dickens added a comment - When I said it builds, I meant 'mvn install's (to your local repository). However, doing a 'mvn deploy' to your internal repository appears to require various changes (which I haven't been able to fathom). Also, repeating the 'mvn install' appears to require that you manually delete various target directories.
Hide
Jason van Zyl added a comment -

This now works.

Show
Jason van Zyl added a comment - This now works.
Hide
Alexandre Poitras added a comment -

What do I need to compile and install to get this issue fixed? Only the plugin???

Show
Alexandre Poitras added a comment - What do I need to compile and install to get this issue fixed? Only the plugin???
Hide
Wendy Smoak added a comment -

I'm fairly sure -DremoteRepositories=[repo-url] works in the latest released version of the plugin.

Try adding -U on the command line once to make sure you have the latest version.

If you're still having trouble, ask on the user list.

Show
Wendy Smoak added a comment - I'm fairly sure -DremoteRepositories=[repo-url] works in the latest released version of the plugin. Try adding -U on the command line once to make sure you have the latest version. If you're still having trouble, ask on the user list.

People

Vote (21)
Watch (6)

Dates

  • Created:
    Updated:
    Resolved: