maven, maven-glassfish-plugin, domain creation - maven

I try to create domain by maven
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>${glassfish.home}</glassfishDirectory>
<user>${glassfish.username}</user>
<adminPassword>${glassfish.password}</adminPassword>
<autoCreate>true</autoCreate>
<debug>true</debug>
<echo>true</echo>
<terse>true</terse>
<domain>
<name>${project.artifactId}</name>
<adminPort>4048</adminPort>
<httpPort>4080</httpPort>
<httpsPort>4043</httpsPort>
<iiopPort>4037</iiopPort>
<reuse>false</reuse>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
domain created but not started
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building EventLogger
[INFO] task-segment: [org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:deploy]
[INFO] ------------------------------------------------------------------------
[INFO] [glassfish:deploy {execution: default-cli}]
[INFO] Domain event-logger isn't started. Starting it for you.
[INFO] Domain event-logger does not exist. Creating it for you.
[INFO] CLI031 Warning: Option "profile" is obsolete and will be ignored.
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile /tmp/mgfp1661748332213879832.tmp --interactive=false --echo=true --terse=true create-domain --adminport 4048 --profile developer --domaindir /home/makaka/glassfish3/glassfish/domains --instanceport 4080 --savemasterpassword=false --usemasterpassword=false --domainproperties http.ssl.port=4043:orb.listener.port=4037 --savelogin=false --nopassword=false --checkports=true event-logger
[INFO] The AS_ADMIN_ADMINPASSWORD option in the password file is deprecated.
[INFO] Use AS_ADMIN_PASSWORD instead.
[INFO] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [CN=ubuntu,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
[INFO] Distinguished Name of the self-signed X.509 Server Certificate is:
[INFO] [CN=ubuntu-instance,OU=GlassFish,O=Oracle Corporation,L=Santa Clara,ST=California,C=US]
[INFO] No domain initializers found, bypassing customization step
[INFO] Domain event-logger created.
[INFO] Domain event-logger admin port is 4048.
[INFO] Domain event-logger admin user is "admin".
[INFO] asadmin --host localhost --port 4848 --user admin --passwordfile /tmp/mgfp1661748332213879832.tmp --interactive=false --echo=true --terse=true start-domain --verbose=false --upgrade=false --debug=true --_dry-run=false --domaindir /home/makaka/glassfish3/glassfish/domains event-logger
[ERROR] The Master Password is required to start the domain. No console, no prompting possible. You should either create the domain with --savemasterpassword=true or provide a password file with the --passwordfile option.
[ERROR] Unable to start domain "event-logger".
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Unable to start domain "event-logger".
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14 seconds
[INFO] Finished at: Tue Nov 27 21:03:48 MSK 2012
[INFO] Final Memory: 4M/74M
[INFO] ------------------------------------------------------------------------
Right after creation I can manually start domain, but can't log in to admin panel - invalid password.
If after creation I manually reset the password - Maven still can't start domain. But I can manually start domain from command line and then login to admin panel...
I tried to use passwordFile instead of adminPassword. Nothing changed... Content of that file (I created it manually):
AS_ADMIN_MASTERPASSWORD myPass
AS_ADMIN_USERPASSWORD myPass
AS_ADMIN_ALIASPASSWORD myPass
Also I wonder why asadmin needs master password - it's not for autentification master pass description
Any ideas what's wrong?
P.S. I use ubunutu 12.10, glassfish 3.1.2.2, used developer profile to install glassfish

I had a wrong password file. It should contain
AS_MASTER_PASSWORD=myPass1
AS_ADMIN_PASSWORD=myPass2
AS_ADMIN_USERPASSWORD=myPass3

Related

How to use gradle-enterprise-maven-extension behind a proxy?

Willing to use the gradle-enterprise-maven-extension
to migrate a project from maven to gradle,
I cloned the maven-build-scan-quickstart provided by the gradle team.
But runing mvn install, as specified, after acceptation of gradle terms of service,
I receive the following message:
UnknownHostException: scans-in.gradle.com
I tried to configure the proxy in several manners:
Using commannd line option:
mvn install -Dhttps.proxyHost=localhost:8888 -Dhttps.proxyPort=localhost:8888
Using a gradle.properties file in a directory at %GRADLE_USER_HOME% directory location:
(proxy is also configured in maven's settings.xml and need no password it works fine when using maven in standard ways)
gradle.properties :
systemProp.http.proxyHost=localhost
systemProp.http.proxyPort=8888
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost|127.0.0.1
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=8888
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost|127.0.0.1
But I still receive the same message:
~/github/maven-build-scan-quickstart
$ mvn install
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.830 s
[INFO] Finished at: 2019-12-31T13:09:19+01:00
[INFO] ------------------------------------------------------------------------
[INFO] 7 goals, 7 executed
Publishing a build scan to scans.gradle.com requires accepting the Gradle Terms of Service defined at https://gradle.com/terms-of-service. Do you accept these terms? (yes/no): yes
[INFO] Gradle Terms of Service accepted.
[INFO]
[INFO] Publishing build scan...
[INFO]
[INFO] A network error occurred.
[INFO]
[INFO] The hostname 'scans-in.gradle.com' could not be resolved.
[INFO] You may be disconnected from the Internet.
[INFO]
[INFO] If you require assistance with this problem, please report it via https://gradle.com/help/plugin and include the following information via copy/paste.
[INFO]
[INFO] ----------
[INFO] Maven version: 3.6.2
[INFO] Extension version: 1.3.3
[INFO] Request URL: https://scans-in.gradle.com/in/maven/3.6.2/1.3.3
[INFO] Request ID: 1234567e-abcd-23de-c2d3-3fbbccd14a32
[INFO] Exception: java.net.UnknownHostException: scans-in.gradle.com
[INFO] ----------
[INFO]

How to debug "The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found"?

This is what I am trying to do. I have installed Maven. Set the path till bin folder of Maven.
C:\Workspace\Eaxample>mvn archetype:generate -DgroupId=com.mkyong -DartifactId=N
umberGenerator
[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: Error transferring file: Connecti
on timed out: connect
[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: 21 seconds
[INFO] Finished at: Tue Nov 24 14:04:15 IST 2015
[INFO] Final Memory: 5M/122M
You forget archetypeArtifactId :
Do this :
mvn archetype:generate -DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
http://www.mkyong.com/maven/how-to-create-a-java-project-with-maven/

"Auth fail" error with maven-scm-provider-jgit during release:prepare

I am on a windows machine where git command line is not installed. I have installed GitExtensions and an EGit and this is sufficient for me (until now).
Now I wanted to perform a maven release to BinTray, following this guide:
Publishing releases using Github, Bintray and maven-release-plugin
Running:
mvn -Prelease release:prepare
Produces this output:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml"
[INFO] Working directory: C:\Users\jbr\git\yyyyyyyyyyyyyyy
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.770 s
[INFO] Finished at: 2015-09-12T20:17:24+02:00
[INFO] Final Memory: 20M/989M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-add command failed.
[ERROR] Command output:
[ERROR] 'git' is not recognized as an internal or external command,
[ERROR] operable program or batch file.
Absolutely fair, I never use the git command from the windows shell and I never set up the pageant.exe stuff. (for details see this answer to the question “Why git can't remember my passphrase under Windows”).
My second idea was to use the maven-scm-provider-jgit to not depend on the git command line.
The output is now:
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxx 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.4.1:prepare (default-cli) # xxxxx ---
[INFO] Change the default 'git' provider implementation to 'jgit'.
[INFO] Resuming release from phase 'scm-commit-release'
[INFO] Checking in modified POMs...
[INFO] push changes to remote... refs/heads/master:refs/heads/master
[INFO] fetch url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] push url: git#github.com:jmini/yyyyyyyyyyyyyyy.git
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:prepare (default-cli) on project xxxxx: An error is occurred in the checkin process: Exception while executing SCM command. JGit checkin failure! git#github.com:jmini/yyyyyyyyyyyyyyy.git: Auth fail -> [Help 1]
Much better, but still no luck.
My guess is that the private key and the passphrase are not loaded. How should I configure them?
This answer suggests that for some SCM providers, it is possible to specify the credentials in the <servers> section of settings.xml. The domain name of the repository should be used as <id>.
According to the last comment with scm:git:ssh://git#bitbucket.org/{account}/{project} used in the <developerConnection>, this entry is working in the settings.xml:
<server>
<id>bitbucket.org</id>
<privateKey>/c/Users/neil.hunt/.ssh/id_rsa</privateKey>
</server>
Is this construct supported by the JGit SCM provider?
When searching for “Auth failed” error, I found this related question (plain JGit, no maven plugin):
How do you set the configuration for jschconfigsessionfactory for jgit so that pull and push work?

Bamboo Maven Glassfish Deploy

I've been trying to set up continuous integration and deployment for a Java EE application.
Continuous integration is working however the deployment always fail.
I tried 3 things in the maven parameter ${local.glassfish.passfile}:
path to domain-password
path to.gfclient/pass
password string
One last thing I tried was:
hardcoded value inside pom.xml
Ear pom.xml configuration:
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>${local.glassfish.home}</glassfishDirectory>
<user>${local.glassfish.user}</user>
<passwordFile>${local.glassfish.passfile}</passwordFile>
<domain>
<name>${local.glassfish.domain}</name>
<adminPort>${local.glassfish.adminPort}</adminPort>
<httpPort>${local.glassfish.httpPort}</httpPort>
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>target/${project.build.finalName}.ear</artifact>
</component>
</components>
<debug>true</debug>
<terse>false</terse>
<echo>true</echo>
</configuration>
</plugin>
Running mvn glassfish:deploy inside the ear folder via the terminal successfully deploys the ear artefact to the server.
Bamboo Error log:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ear 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-glassfish-plugin:2.1:undeploy (default-cli) # ear ---
[INFO] Deprecated syntax, instead use:
[INFO] asadmin --echo --terse=false --interactive=false --user admin --passwordfile /home/guest/.gfclient/pass --host localhost --port 55004 undeploy [options] ...
[INFO] asadmin --host localhost --port 55004 --user admin --passwordfile /home/guest/.gfclient/pass --interactive=false --echo=true --terse=false undeploy --keepreposdir=false --isredeploy=false --cascade=false --_ignorecascade=false --_classicstyle=false ear
[INFO] Command undeploy failed.
[ERROR] Authentication failed for user: admin
[ERROR] (Usually, this means invalid user name and/or password)
[ERROR] Undeployment of ear failed.
[ERROR] For more detail on what might be causing the problem try running maven with the --debug option
[ERROR] or setting the maven-glassfish-plugin "echo" property to "true".
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.699 s
[INFO] Finished at: 2014-03-06T17:39:50+00:00
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.glassfish.maven.plugin:maven-glassfish-plugin:2.1:undeploy (default-cli) on project ear: Undeployment of ear failed. -> [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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Failing task since return code of [/home/guest/apache-maven-3.2.1/bin/mvn glassfish:undeploy] was 1 while expected 0
Finished task 'Maven Glassfish Undeploy'
Note that I ran the "asadmin login" command after I changed the admin password in order to update the pass file.
guest#foo:~$ asadmin --port 55004 login
Enter admin user name [Enter to accept default]> admin
Enter admin password>
Admin login information for host [localhost] and port [55004] is being overwritten with credentials provided. This is because the --savelogin option was used during create-domain command.
Login information relevant to admin user name [admin] for host [localhost] and admin port [55004] stored at [/home/guest/.gfclient/pass] successfully.
Make sure that this file remains protected. Information stored in this file will be used by administration commands to manage associated domain.
Command login executed successfully.
Also, Glassfish version is 4.0, Maven version is 3.2.1.
If you have used the asadmin login command you don't need to specify the user and password in the undeploy and deploy command as it will use the credentials that you've set using the login command.
There is a Bamboo plugin that allows to deploy an war file to Glassfish Application Server.
https://marketplace.atlassian.com/apps/1219234/tasks-for-glassfish-server

Settings for Maven for conditional checkout or update from SVN?

I have following settings in POM file.But my build script fails with 'SVN file locked' message.Is there any other way to do conditional checkout.If project is already checked out then I want to update only otherwise if project is not checkedout it should check out the code and should not update it.Thanks in advance.
<!-- Initial check out of (will not do anything if directory already there) -->
<execution>
<id>check-out-project</id>
<phase>generate-sources</phase>
<goals>
<goal>checkout</goal>
</goals>
<configuration>
<checkoutDirectory>${project.build.directory}/project</checkoutDirectory>
<connectionUrl>scm:svn:http://XX:XX/svn/repos/${XX}</connectionUrl>
<username>${svn.username}</username>
<password>${svn.password}</password>
<skipCheckoutIfExists>true</skipCheckoutIfExists>
</configuration>
</execution>
<!-- Update project (if directory was already there) -->
<execution>
<id>update-project</id>
<phase>generate-sources</phase>
<goals>
<goal>update</goal>
</goals>
<configuration>
<basedir>${project.build.directory}/project</basedir>
<connectionUrl>scm:svn:http://XXX:XXX/svn/repos/${project}</connectionUrl>
<username>${svn.username}</username>
<password>${svn.password}</password>
<revisionKey>project.revision</revisionKey>
</configuration>
</execution>
Error log after running maven (Please note I have replaced directory paths and urls with xxxx)
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxxxx.and.xxxxxx 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-xxxxxx-xxxxxx) # xxxxxx.and.
xxxxxx ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-sat) # xxxxxx.and.xxxxxx ---
[INFO]
[INFO] --- maven-scm-plugin:1.4:checkout (check-out-xxxxxx) # xxxxxx.and.xxxxxx --
-
[INFO] Removing x:\xxxx\xxxx\target\xxxxxx
[INFO] Executing: cmd.exe /X /C "svn --username xxxx --password ***** --no-aut
h-cache --non-interactive checkout http://xxxx:xxx/svn/repos/xxxx/xxx x:\
projects\xxxx\target\xxxxxx"
[INFO] Working directory: x:\xxxx\xxxx\target
[INFO]
[INFO] --- maven-scm-plugin:1.4:update (update-xxxxxx) # xxxxxx.and.xxxxxx ---
[INFO] Executing: cmd.exe /X /C "svn --username xxxx --password ***** --no-aut
h-cache --non-interactive update x:\xxxx\xxx\target\xxxxxx"
[INFO] Working directory: x:\xxx\xxx\target\xxxxxx
[INFO] Svn command failed due to some locks in working copy. We try to run a 'sv
n cleanup'.
[INFO] Executing: cmd.exe /X /C "svn"
[INFO] Working directory: x:\xxx\xxxx\target\xxxxxx
[ERROR] Provider message:
[ERROR] The svn command failed.
[ERROR] Command output:
[ERROR] svn: Working copy 'x:\xxxx\xxxx\target\xxxxxx' locked
svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details)
Type 'svn help' for usage.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8:03.303s
[INFO] Finished at: Thu Apr 28 17:24:50 BST 2011
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-plugin:1.4:upd
ate (update-xxxxxx) on project xxxxxx.and.xxxxxx: Command failed.The svn command f
ailed. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
First run
mvn clean
After this run
mvn scm:update

Resources