bmatthews68 / ldap-maven-plugin

A Maven plugin that runs an embedded LDAP directory server within the Maven build life-cycle and imports/exports data to/from an LDAP directory server.
http://ldap-maven-plugin.btmatthews.com
Apache License 2.0
6 stars 18 forks source link

How to keep the server running with the run goal? #29

Open jeffjensen opened 7 years ago

jeffjensen commented 7 years ago

Hi, Having this config in POM:

<plugin>
  <groupId>com.btmatthews.maven.plugins</groupId>
  <artifactId>ldap-maven-plugin</artifactId>
  <configuration>
    <monitorPort>11389</monitorPort>
    <monitorKey>ldap</monitorKey>
    <daemon>true</daemon>
    <rootDn>dc=company,dc=com</rootDn>
    <ldapPort>10389</ldapPort>
    <ldifFile>${basedir}/src/test/resources/data.ldif</ldifFile>
  </configuration>
</plugin>

works correctly with the mvn verify lifecycle.

However, running this command: mvn com.btmatthews.maven.plugins:ldap-maven-plugin:run outputs the configured items and exits, the server does not stay running. Occurs with both UnboundID and ApacheDS.

How do I keep the server running?

Using version 1.3.2, currently the latest release.

bmatthews68 commented 7 years ago

Hi Jeff,

I will look into your problem when I get home from work. It may not be relevant but can you provide your Maven version by sending me the output from mvn -v. Are there any console logs you can send?

On 25 May 2017 7:49 am, "Jeff Jensen" notifications@github.com wrote:

Hi, Having this config in POM:

com.btmatthews.maven.plugins ldap-maven-plugin 11389 ldap true dc=company,dc=com 10389 ${basedir}/src/test/resources/data.ldif

works correctly with the mvn verify lifecycle.

However, running this command: mvn com.btmatthews.maven.plugins: ldap-maven-plugin:run outputs the configured items and exits, the server does not stay running. Occurs with both UnboundID and ApacheDS.

How do I keep the server running?

Using version 1.3.2, currently the latest release.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bmatthews68/ldap-maven-plugin/issues/29, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGEueVnDWVhGnWLHSyLV54O5HqphHqmks5r9SSOgaJpZM4NmBus .

jeffjensen commented 7 years ago

Hi Brian, thank you in advance for looking into the issue. The two items you asked for:

mvn -v:

Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T14:39:06-05:00)
Maven home: C:\apps\apache-maven-3.5.0\bin\..
Java version: 1.8.0_112, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_112\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Maven console output from the command:

[INFO] --- ldap-maven-plugin:1.3.2:run (default-cli) @ [snipped module name] ---
[INFO] Configured working directory for directory server: [snipped dir name]
[INFO] Configured admin credentials for directory server: secret
[INFO] Configured root DN for directory server: dc=company,dc=com
[INFO] Configured LDIF seed data source for directory server: [snipped file name]
[INFO] Configured TCP port for directory server: 10389
[INFO] Configured admin identity for directory server: uid=admin,ou=system
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

Interestingly, when running the mvn verify lifecycle, the LDAP server "starting" log messages appear in the section of the next plugin (for me it is the Cargo plugin starting Tomcat). Not sure if this is relevant or simply log output ordering, but it's the only plugin of this type (starting a daemon) that has this log anomaly. This is probably #15.

[snipped prior output]
[INFO] Configured TCP port for directory server: 10389
[INFO] Configured admin identity for directory server: uid=admin,ou=system
[INFO]
[INFO] --- cargo-maven2-plugin:1.6.3:start (start-cargo) @ [snipped module name] ---
[INFO] Starting UnboundID server
[INFO] Started UnboundID server
[INFO] Waiting for command from client
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.6.3 for container tomcat8x
[INFO] [talledLocalContainer] Tomcat 8.x starting...
[snipped further output]
jeffjensen commented 7 years ago

Wondering if you've had a chance to look into this and reproduced it?

bmatthews68 commented 7 years ago

Hi Jeff,

Sorry but I've been busy with work and CoderDojo.

The reason that its not staying running in the foregound is because:

true

I hadn't really considered that somebody would want to mix the two usage patterns as you have. I'll check the impact of changing the mojo for the run goal to ignore the daemon flag setting and treat it as false by default.

Kind regards, Brian

http://btmatthews.com http://ie.linkedin.com/in/bmatthews68 https://plus.google.com/+BrianMatthews68 http://twitter.com/bmatthews68 https://www.facebook.com/bmatthews68 http://blog.btmatthews.com/

On 31 May 2017 at 09:44, Jeff Jensen notifications@github.com wrote:

Wondering if you've had a chance to look into this and reproduced it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bmatthews68/ldap-maven-plugin/issues/29#issuecomment-305125704, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGEuSs1KXmM7J9uSE0233sWr6K46E7Oks5r_ShggaJpZM4NmBus .

jeffjensen commented 7 years ago

Ah, yes, makes sense! Thank you for explaining; the description did not trigger that understanding for me.

Thank you for considering the change with the run goal for both usages. Since I need true for the verify lifecycle and false for CLI, I created a property for with default true in the POM and override it on command line to false. So if the change is not feasible, this configuration works too. Perhaps only need a doc tweak to explain the concept with more detail?

Thank you again.