I'm using Maven 3.0.3 on Mac 10.6.6. After packaging my war, I want to execute an unzip command (I want to do this because I'm using a Grails plugin that deletes the exploded war directory). So I have this in my pom.xml …
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<executable>unzip</executable>
<arguments>
<argument>-d target/jx-1.0-SNAPSHOT target/jx-1.0-SNAPSHOT.war</argument>
</arguments>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
However, when I execute the command that invokes the plugin, I get the error …
[INFO] --- exec-maven-plugin:1.1.1:exec (default-cli) # jx ---
[INFO] UnZip 5.52 of 28 February 2005, by Info-ZIP. Maintained by C. Spieler. Send
[INFO] bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
[INFO]
[INFO] Usage: unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
[INFO] Default action is to extract files in list, except those in xlist, to exdir;
[INFO] file[.zip] may be a wildcard. -Z => ZipInfo mode ("unzip -Z" for usage).
[INFO]
[INFO] -p extract files to pipe, no messages -l list files (short format)
[INFO] -f freshen existing files, create none -t test compressed archive data
[INFO] -u update files, create if necessary -z display archive comment
[INFO] -x exclude files that follow (in xlist) -d extract files into exdir
[INFO]
[INFO] modifiers: -q quiet mode (-qq => quieter)
[INFO] -n never overwrite existing files -a auto-convert any text files
[INFO] -o overwrite files WITHOUT prompting -aa treat ALL files as text
[INFO] -j junk paths (do not make directories) -v be verbose/print version info
[INFO] -C match filenames case-insensitively -L make (some) names lowercase
[INFO] -X restore UID/GID info -V retain VMS version numbers
[INFO] -K keep setuid/setgid/tacky permissions -M pipe through "more" pager
[INFO] Examples (see unzip.txt for more info):
[INFO] unzip data1 -x joe => extract all files except joe from zipfile data1.zip
[INFO] unzip -p foo | more => send contents of foo.zip via pipe into program more
[INFO] unzip -fo foo ReadMe => quietly replace existing ReadMe if archive file newer
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
Any ideas what I'm doing wrong? Thanks, - Dave
You're packing multiple arguments into one <argument>. That element takes exactly one argument, like "-d" or "target/jx-1.0-SNAPSHOT" from your example. You either have to break them up, or you can try using <commandlineArgs> instead.
As Ryan writes, you'll want this:
<argument>-d</argument>
<argument>target/jx-1.0-SNAPSHOT</argument>
<argument>target/jx-1.0-SNAPSHOT.war</argument>
But also, you are hard-coding lots of stuff that should be implemented using maven variables. So here's a better version:
<argument>-d</argument>
<argument>${project.build.directory}/${project.build.finalName}</argument>
<argument>${project.build.directory}/${project.build.finalName}.${project.packaging}</argument>
Related
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
I try to install a test version of hippocms. I stuck in
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 45:21 min
[INFO] Finished at: 2017-02-16T15:18:32+01:00
[INFO] Final Memory: 16M/200M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start (cargo-run) on project gogreen: Execution cargo-run of goal org.codehaus.cargo:cargo-maven2-plugin:1.4.19:start failed: Failed to create deployable with implementation class org.codehaus.cargo.container.tomcat.TomcatWAR for the parameters (container [id = [tomcat8x]], deployable type [war]). InvocationTargetException: Failed to parse Tomcat WAR file in [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: Failed to find file [/courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war]: /courierOS-7.x/p.rader/Downloads/developer-trail-11.0.2-iteration-2/cms/target/cms.war (No such file or directory) -> [Help 1]
Any idea?
Today I repeat mvn clean install -X and it worked fine.
For every other guy who came here by search: The -Pcargo.run uses tomcat and the built-in tomcat-users.xml so the only valid account is admin and password admin like tomcat does.
Have you tried a clean install before running cargo?
mvn clean install && mvn -Pcargo.run
edit:
The more modern way of doing it would be:
mvn clean verify
and then do your cargo.run.
see also Build Project
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>
Wicket gives a simple "quickstart" command generator for use with Maven on their homepage at http://wicket.apache.org/start/quickstart.html
I installed this and understand that Maven automatically downloads requisites that it needs from its central repository. But when I run the command it generates, I get:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.161s
[INFO] Finished at: Fri May 06 22:07:28 EDT 2011
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (C:\Users\xxxxxx\Projects\[project dir]). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
What am I doing wrong?
the message suggests that Maven didn'recognize archetype plugin.
Can you copy and paste exact command that you are using?
Are using Windows cmd shell?
Try escaping arguments.
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.