standalone parent pom deployment issue - apache

I'm having a simple parent pom for a centralized definition of the company name and the connection to the artifact repository
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.company</groupId>
<artifactId>pom-company</artifactId>
<version>1.3-SNAPSHOT</version>
<packaging>pom</packaging>
<organization>
<name>My company name</name>
</organization>
<scm>
<connection>scm:git:http://gitlab/projects/pom-company.git</connection>
<developerConnection>scm:git:git#gitlab/projects/pom-company.git</developerConnection>
<url>http://gitlab/projects/pom-company</url>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<id>archiva.internal</id>
<name>Internal Release Repository</name>
<url>http://archiva/repository/internal</url>
</repository>
</distributionManagement>
</project>
It also contains a proven valid <scm> connection. Now I release:prepare && release:perform but the artifact (version 1.3 in this case) will not be deployed as expected to the artifact repository by maven. Surprisingly the Snapshot version has been deployed. The corresponding profile in my settings.xml tells only to enable the upload of releases, not snapshots. This configuration worked so far for every other project.
Another strange fact is that the pom.xml remains in changed but not checked in status for git after the process. The only thing that is marked as changed is this one in the pom.xml:
<version>1.4-SNAPSHOT</version>
I have no idea what the reason could be and hope that someone has an idea.
Update
I have corrected the project version in the upper pom.xml from 1.4-SNAPSHOT to 1.3-SNAPSHOT
additional info: the project consists of nothing else but only the pom.xml
I use the maven version 3.3.1
Here is the output of release:prepare as requested in a comment:
------------------------------------------------------------------------
Building pom-company 1.3-SNAPSHOT
------------------------------------------------------------------------
--- maven-release-plugin:2.3.2:prepare (default-cli) # pom-company ---
Verifying that there are no local modifications...
ignoring changes on: **/pom.xml.backup, **/release.properties, **/pom.xml.branch, **/pom.xml.next, **/pom.xml.releaseBackup, **/pom.xml.tag
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git status
Working directory: /home/thomas/workspace/maven/pom-company
Checking dependencies and plugins for snapshots ...
What is the release version for "pom-company"? (de.company:pom-company) 1.3: :
What is SCM release tag or label for "pom-company"? (de.company:pom-company) pom-company-1.3: :
What is the new development version for "pom-company"? (de.company:pom-company) 1.4-SNAPSHOT: :
Transforming 'pom-company'...
Not generating release POMs
Executing goals 'clean verify'...
Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pom-company 1.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # pom-company ---
[INFO] Deleting /home/thomas/workspace/maven/pom-company/target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.276 s
[INFO] Finished at: 2015-05-21T07:56:41+02:00
[INFO] Final Memory: 6M/239M
[INFO] ------------------------------------------------------------------------
Checking in modified POMs...
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git add -- pom.xml
Working directory: /home/thomas/workspace/maven/pom-company
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git status
Working directory: /home/thomas/workspace/maven/pom-company
Tagging release with the label pom-company-1.3...
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git tag -F /tmp/maven-scm-215434904.commit pom-company-1.3
Working directory: /home/thomas/workspace/maven/pom-company
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git push git#gitlab:projects/pom-company.git pom-company-1.3
Working directory: /home/thomas/workspace/maven/pom-company
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git ls-files
Working directory: /home/thomas/workspace/maven/pom-company
Transforming 'pom-company'...
Not removing release POMs
Checking in modified POMs...
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git add -- pom.xml
Working directory: /home/thomas/workspace/maven/pom-company
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company && git status
Working directory: /home/thomas/workspace/maven/pom-company
Release preparation complete.
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 43.212 s
Finished at: 2015-05-21T07:56:48+02:00
Final Memory: 11M/239M
------------------------------------------------------------------------
and the output of release:perform:
------------------------------------------------------------------------
Building pom-company 1.4-SNAPSHOT
------------------------------------------------------------------------
--- maven-release-plugin:2.3.2:perform (default-cli) # pom-company ---
Checking out the project to perform the release ...
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company/target && git clone --branch pom-company-1.3 git#gitlab:projects/pom-company.git /home/thomas/workspace/maven/pom-company/target/checkout
Working directory: /home/thomas/workspace/maven/pom-company/target
Executing: /bin/sh -c cd /tmp && git ls-remote git#gitlab:projects/pom-company.git
Working directory: /tmp
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company/target/checkout && git fetch git#gitlab:projects/pom-company.git
Working directory: /home/thomas/workspace/maven/pom-company/target/checkout
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company/target/checkout && git checkout pom-company-1.3
Working directory: /home/thomas/workspace/maven/pom-company/target/checkout
Executing: /bin/sh -c cd /home/thomas/workspace/maven/pom-company/target/checkout && git ls-files
Working directory: /home/thomas/workspace/maven/pom-company/target/checkout
Invoking perform goals in directory /home/thomas/workspace/maven/pom-company/target/checkout
Executing goals 'deploy'...
Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for de.lotto.nds:pom-company:pom:1.3-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing.
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing.
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-source-plugin is missing.
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pom-company 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://archiva/repository/internal/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml
Downloaded: http://archiva/repository/internal/org/apache/maven/plugins/maven-source-plugin/maven-metadata.xml (747 B at 0.6 KB/sec)
Downloading: http://archiva/repository/internal/org/apache/maven/plugins/maven-javadoc-plugin/maven-metadata.xml
Downloaded: http://archiva/repository/internal/org/apache/maven/plugins/maven-javadoc-plugin/maven-metadata.xml (911 B at 32.9 KB/sec)
[INFO]
[INFO] >>> maven-source-plugin:2.4:jar (attach-sources) > generate-sources # pom-company >>>
[INFO]
[INFO] <<< maven-source-plugin:2.4:jar (attach-sources) < generate-sources # pom-company <<<
[INFO]
[INFO] --- maven-source-plugin:2.4:jar (attach-sources) # pom-company ---
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.3:jar (attach-javadocs) # pom-company ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # pom-company ---
[INFO] Installing /home/thomas/workspace/maven/pom-company/target/checkout/pom.xml to /home/thomas/.m2/repository/de/company/pom-company/1.3-SNAPSHOT/pom-company-1.3-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) # pom-company ---
Downloading: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/maven-metadata.xml
Downloaded: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/maven-metadata.xml (354 B at 0.1 KB/sec)
Uploading: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/pom-company-1.3-20150521.060109-2.pom
Uploaded: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/pom-company-1.3-20150521.060109-2.pom (2 KB at 26.3 KB/sec)
Downloading: http://archiva/repository/internal/de/company/pom-company/maven-metadata.xml
Downloaded: http://archiva/repository/internal/de/company/pom-company/maven-metadata.xml (426 B at 34.7 KB/sec)
Uploading: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/maven-metadata.xml
Uploaded: http://archiva/repository/internal/de/company/pom-company/1.3-SNAPSHOT/maven-metadata.xml (592 B at 36.1 KB/sec)
Uploading: http://archiva/repository/internal/de/company/pom-company/maven-metadata.xml
Uploaded: http://archiva/repository/internal/de/company/pom-company/maven-metadata.xml (425 B at 27.7 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.222 s
[INFO] Finished at: 2015-05-21T08:01:09+02:00
[INFO] Final Memory: 16M/239M
[INFO] ------------------------------------------------------------------------
Cleaning up after release...
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 10.550 s
Finished at: 2015-05-21T08:01:10+02:00
Final Memory: 11M/239M
------------------------------------------------------------------------

Did you try the release plugin with another version? The latest is the 2.5.2. You could add it in your pom.xml and see what happens
<build>
[...]
<plugins>
[...]
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</plugin>
[...]
</plugins>
[...]
</build>

Related

Jenkins Selenium Maven project | Build Success but Test doesn't executed

I have written a simple selenium program in maven project. It will just search wrist watches form amazon with filters and get the fifth result.
From Local Machine, through eclipse it is running completely fine. After that I have pushed it to git repository (https://github.com/nasirpk3/AmazonSearching-Selenium-Java.git) and Integrated with jenkins. When I run using the jenkins. The console shows the following. What I am doing wrong?
Started by user Nasir Sultan
Running as SYSTEM
Building in workspace C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob
The recommended git tool is: NONE
No credentials specified
> git.exe rev-parse --resolve-git-dir C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\.git # timeout=10
Fetching changes from the remote Git repository
> git.exe config remote.origin.url https://github.com/nasirpk3/AmazonSearching-Selenium-Java.git # timeout=10
Fetching upstream changes from https://github.com/nasirpk3/AmazonSearching-Selenium-Java.git
> git.exe --version # timeout=10
> git --version # 'git version 2.34.1.windows.1'
> git.exe fetch --tags --force --progress -- https://github.com/nasirpk3/AmazonSearching-Selenium-Java.git +refs/heads/*:refs/remotes/origin/* # timeout=10
> git.exe rev-parse "refs/remotes/origin/master^{commit}" # timeout=10
Checking out Revision 97dd70600038d84555f6867f545a28ec00f24b5e (refs/remotes/origin/master)
> git.exe config core.sparsecheckout # timeout=10
> git.exe checkout -f 97dd70600038d84555f6867f545a28ec00f24b5e # timeout=10
Commit message: "pom file edit"
> git.exe rev-list --no-walk 4f4aaf415fa286aebe7d24b2358a134fe287fef7 # timeout=10
Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 56233
[amazonsearchjob] $ "C:\Program Files\Java\jdk-17.0.3.1/bin/java" -cp C:\Users\nasir.n\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-agent-1.13.jar;C:\Users\nasir.n\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\testmaven\boot\plexus-classworlds-2.6.0.jar;C:\Users\nasir.n\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\testmaven/conf/logging jenkins.maven3.agent.Maven35Main C:\Users\nasir.n\.jenkins\tools\hudson.tasks.Maven_MavenInstallation\testmaven C:\Users\nasir.n\.jenkins\war\WEB-INF\lib\remoting-3025.vf64a_a_3da_6b_55.jar C:\Users\nasir.n\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven35-interceptor-1.13.jar C:\Users\nasir.n\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.13.jar 56233
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\pom.xml install
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------------------< in:amazon >------------------------------
[INFO] Building amazon 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # amazon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # amazon ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # amazon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # amazon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # amazon ---
[INFO] Surefire report directory: C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running tests.BaseTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#22a71081
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.641 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # amazon ---
[INFO] Building jar: C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\target\amazon-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # amazon ---
[INFO] Installing C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\target\amazon-0.0.1-SNAPSHOT.jar to C:\Users\nasir.n\.m2\repository\in\amazon\0.0.1-SNAPSHOT\amazon-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\pom.xml to C:\Users\nasir.n\.m2\repository\in\amazon\0.0.1-SNAPSHOT\amazon-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.269 s
[INFO] Finished at: 2022-06-22T14:09:04+05:00
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\pom.xml to in/amazon/0.0.1-SNAPSHOT/amazon-0.0.1-SNAPSHOT.pom
[JENKINS] Archiving C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob\target\amazon-0.0.1-SNAPSHOT.jar to in/amazon/0.0.1-SNAPSHOT/amazon-0.0.1-SNAPSHOT.jar
channel stopped
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level C:\Users\nasir.n\.jenkins\workspace\amazonsearchjob to C:\Users\nasir.n\.jenkins\jobs\amazonsearchjob\htmlreports\HTML_20Report
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
Saving reports...
Processing 'C:\Users\nasir.n\.jenkins\jobs\amazonsearchjob\builds\2\testng\testng-results-1.xml'
Processing 'C:\Users\nasir.n\.jenkins\jobs\amazonsearchjob\builds\2\testng\testng-results.xml'
TestNG Reports Processing: FINISH
Finished: SUCCESS

gitlab-ci Auto Devops: mvn: command not found on test step

I tried to enable an "Auto Devops" pipeline for my private project on Gitlab.com. The "Build" step runs fine, but then the "Test" step fails. What's strange is that the beginning of the step goes well (the mvn test-compile part), but then it seems to lose the path to mvn:
$ # Auto DevOps variables and functions # collapsed multi-line command
$ setup_test_db
$ cp -R . /tmp/app
$ /bin/herokuish buildpack test
-----> Java app detected
-----> Installing JDK 1.8... done
-----> Installing Maven 3.3.9... done
-----> Executing: mvn clean dependency:resolve-plugins test-compile
[INFO] Scanning for projects...
<SNIP>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.953 s
[INFO] Finished at: 2018-04-01T17:22:11+00:00
[INFO] Final Memory: 23M/169M
[INFO] ------------------------------------------------------------------------
/tmp/buildpacks/05_buildpack-java/bin/test: line 24: mvn: command not found
There is a bug in heroku java buildpack < v60 that will mess with maven installation during tests execution.
It has been fixed and bundled in herokuish 0.4.1
If you re-run your autodevops now it will work.
source: https://gitlab.com/gitlab-org/gitlab-ce/issues/44980

Maven adds '-windows' to the artifact name when downloading a snapshot artifact

I have added a bunch of artifacts to my local Nexus Maven repository.
When I build my project I get the following error:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building pronto-web Java EE 6 Webapp
[INFO] task-segment: [verify]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 4 resources
[INFO] [compiler:compile {execution: default-compile}]
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to C:\Source\Pronto\pronto\pronto-web\target\classes
[INFO] [antrun:run {execution: remove-javax}]
[INFO] Executing tasks
[INFO] Executed tasks
[INFO] [gwt:compile {execution: default}]
[INFO] using GWT jars from project dependencies : 20100714-SNAPSHOT
[WARNING] You should not declare gwt-dev as a project dependency. This may introduce complex dependency conflicts
Downloading: http ://mercury:8980/nexus/content/groups/public-snapshots/com/google/gwt/gwt-dev/20100714-SNAPSHOT/gwt-dev-20100714-20100715.053026-1-windows.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] artifact not found - Unable to locate resource in repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.google.gwt -DartifactId=gwt-dev -Dversion=20100714-20100715.053026-1 -Dclassifier=windows -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.google.gwt -DartifactId=gwt-dev >-Dversion=20100714-20100715.053026-1 -Dclassifier=windows -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
com.google.gwt:gwt-dev:jar:20100714-20100715.053026-1
from the specified remote repositories:
releases (http://mercury:8980/nexus/content/groups/public),
all (http://mercury:8980/nexus/content/groups/all),
snapshots (http://mercury:8980/nexus/content/groups/public-snapshots)
http ://mercury:8980/nexus/content/groups/public-snapshots/com/google/gwt/gwt-dev/20100714-SNAPSHOT/gwt-dev-20100714-20100715.053026-1-windows.jar
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Thu Jul 15 08:57:29 CEST 2010
[INFO] Final Memory: 50M/614M
[INFO] ------------------------------------------------------------------------
Has anyone an idea why maven thinks there should be '-windows' added to the artifact name?
(Downloading: http ://mercury:8980/nexus/content/groups/public-snapshots/com/google/gwt/gwt-dev/20100714-SNAPSHOT/gwt-dev-20100714-20100715.053026-1-windows.jar)
If I browse the repository it contains the artifact but without the '-windows' suffix.
Older versions of this artifact were platform dependent and had 'windows' or 'linux' or 'mac' as classifier but recent versions are platform independent and I don't have any such classifier in my poms.
PS:
I added a space in each URL between the protocol and the colon because I didn't yet receive enough reputation to post links.
The following dependency must be declared somewhere, very likely as a transitive dependency:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>20100714-SNAPSHOT</version>
<classifier>windows</classifier>
<dependency>
I suspect a bad pom if artifacts are not platform dependent anymore.
Is there any more recent snapshot you can use?

Maven2 problem to access plugins repository !

i just come to install maven2, after configuring the settings.xml in ${user.home}/.m2 and fixing a proxy error. Now by executing the command :
mvn -U archetype:create -DgroupId=maven-test -DartifactId=maven-test
-DpackageName=net.ensode.maventest
i get this error :
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Authorization failed: Access deni
ed to: http://repo2.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Apr 29 16:05:40 CEST 2010
[INFO] Final Memory: 2M/247M
[INFO] ------------------------------------------------------------------------
any idea of what could cause it ?
thanks !
I think that the most likely cause is that your proxy requires you to authenticate, and you haven't configured the authentication details into your settings.xml file.

Overwrite archetypes in Maven

I'm having some trouble using Maven for my archetypes and I will need to overwrite some. I launch an instruction that does an archetype:generate in an archetype already existing directory.
Is there a parameter that let's me overwrite existing archetypes?
I have search the maven definitve guide but it states that the only parameters accepted are:
-DgroupId
-DartifactId
-Dversion
-DpackageName
-DarchetypeGroupId
-DarchetypeArtifactId
-DarchetypeVersion
-DinteractiveMode
I could just search the directory and delete the files, but this proccess is going to be done automatically (so no human involved, no brains involved) and I wouldn't like he machine deleting things around.
Thanks for all!
Edit: I almost forgot, here is some maven trace:
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [archetype:generate] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] Preparing archetype:generate
[INFO] No goals needed for project - skipping
[INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on => 'false'.
[INFO] Setting property: resource.loader => 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound => 'false'.
[INFO] [archetype:generate {execution: default-cli}]
[INFO] Generating project in Batch mode
[INFO] Archetype defined by properties
[INFO] ----------------------------------------------------------------------------
[INFO] Using following parameters for creating OldArchetype: archetype-foo-lib:1.0
[INFO] ----------------------------------------------------------------------------
[INFO] Parameter: groupId, Value: foo.tecnologia
[INFO] Parameter: packageName, Value: foo.tecnologia
[INFO] Parameter: basedir, Value: C:\temp\Desarrollo
[INFO] Parameter: package, Value: foo.tecnologia
[INFO] Parameter: version, Value: 1.0
[INFO] Parameter: artifactId, Value: Foo-Lib-Test
[ERROR] Directory Foo-Lib-Test already exists - please run from a clean directory
org.apache.maven.archetype.old.ArchetypeTemplateProcessingException: Directory Foo-Lib-Test already exists - please run from a clean directory
at org.apache.maven.archetype.old.DefaultOldArchetype.createArchetype(DefaultOldArchetype.java:242)
at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.processOldArchetype(DefaultArchetypeGenerator.java:253)
at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:143)
at org.apache.maven.archetype.generator.DefaultArchetypeGenerator.generateArchetype(DefaultArchetypeGenerator.java:286)
at org.apache.maven.archetype.DefaultArchetype.generateProjectFromArchetype(DefaultArchetype.java:69)
at org.apache.maven.archetype.mojos.CreateProjectFromArchetypeMojo.execute(CreateProjectFromArchetypeMojo.java:184)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at com.foo.model.CSMavenCli.main(CSMavenCli.java:391)
at com.foo.model.MavenAdmin.generateArchetype(MavenAdmin.java:399)
at com.foo.model.ValidarPom.validarPom(ValidarPom.java:167)
at com.foo.prueba.GenerarPOM.execute(GenerarPOM.java:93)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] : org.apache.maven.archetype.old.ArchetypeTemplateProcessingException: Directory Foo-Lib-Test already exists - please run from a clean directory
Directory Foo-Lib-Test already exists - please run from a clean directory
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Fri Apr 09 10:01:33 CEST 2010
[INFO] Final Memory: 15M/28M
[INFO] ------------------------------------------------------------------------
I guess you would have to check out the archetype's sources. e.g.
http://svn.apache.org/viewvc/maven/archetype/tags/maven-archetype-quickstart-1.1
apply your changes and run mvn install
that said, you should usually not do it this way
for further reference:
http://maven.apache.org/guides/mini/guide-creating-archetypes.html
I want to override files when regenerating an archetype - similar to your requirements, a user can regenerate a project with different parameters. In my case, I am generating an entire REST stack from a model, and as I make changes to the archetype itself I want to iteratively regenerate all the code.
Part of the reason I want to do this is to leave the IntelliJ project files intact between regens - so that I do not have to re-import the generated project into IntelliJ.
The maven archetype plugin does not override files and does not have an option to enable that.
The solution I found is to delete all files under the generated project except the IntelliJ .iml project files, and leave .idea and all directories intact. Then the archetype plugin will work. I call the archetype plugin from a script and do the delete in that. If 'pp' is the name of the directory containing the project to regenerate:
# This should leave IntelliJ project files intact accross regens.
find pp -type d -name 'target' -exec rm -fR {} \;
find pp -type d -name 'generated' -exec rm -fR {} \;
find pp -type f -not -path '*/.idea/*' -not -name '*.iml' -exec rm {} \;
You should be able to come up with some variation on this to achieve what you want.
There is only a poor man solution:
Simply create the archetype to another directory and then copy that over the existing project to update.