Skip to content

Move build system to Maven (retains Ant tasks for backwards compatibility) #122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2016

Conversation

michaelklishin
Copy link
Contributor

Originally submitted by @PatrickSauts as #119.

This moves build system to Maven while retaining backwards compatibility by offering "proxy" Ant tasks.

@dumbbell
Copy link
Contributor

Fixes #37.

@dumbbell
Copy link
Contributor

The SSL testsuite does bot work because isSSlAvailable() crashes for me and, after when this is fixed, it returns false because sslClientPath points to a directory, not a file. I'm working on it.

@dumbbell
Copy link
Contributor

A bit more details about my last commit: what was done in AbstractRMQTestSuite.java was in fact never called. Maybe because we still rely on JUnit 3 API, not 4. For example, the runTest() was never called so the properties initialized and verified in AbstractRMQTestSuite.java was ineffective.

This probably remained unnoticed because default values for rabbitmqctl.bin and sibling.rabbitmq_test.dir are ok when the Java client is inside the Umbrella. However, the default value for make.bin only works when GNU Make is installed as make, which is not the case on *BSD (GNU Make is available as gmake).

Our testsuite didn't handle well failures from make. Usually, this means the testsuite is stuck. I extended what @PatrickSauts did and added calls from the TestSuites themselves, to be sure we have all properties set before running tests.

Finally, the new broker.{hostname,port,sslport} properties were good when using Maven, but not Ant. That's what confused me yesterday. Now, the top-level build.xml explicitely sets those properties and isSSLAvailable() is back on rails.

@dumbbell
Copy link
Contributor

Hmm, there is one more thing to fix: ClientVersion.java is correctly generated by pom.xml using the impl.version property (set in the top-level Makefile), but pom.xml hard-codes the version for itself (currently set at 3.6.1-SNAPSHOT).

Source files are moved from `src` to `src/main/java`. Tests are moved
from `test` to `src/test/java`.

`build.properties` is moved and split into two files:
    src/test/resources/build.properties
    src/test/resources/config.properties

build.xml is replaced by pom.xml.

Required system properties (eg. `make.bin`) are now verified in
AbstractRMQTestSuite.java. Properties are verified before the tests
start. This avoids to have a testsuite hanging because `make` is not GNU
Make for instance.

Fixes #37.
@dumbbell dumbbell force-pushed the rabbitmq-java-client-37 branch from 0e84540 to fc94c0f Compare January 14, 2016 18:49
dumbbell added a commit that referenced this pull request Jan 14, 2016
Move build system to Maven (retains Ant tasks for backwards compatibility)
@dumbbell dumbbell merged commit d32c250 into master Jan 14, 2016
@dumbbell
Copy link
Contributor

@PatrickSauts: Merged, thank you very much!

@PatrickSauts
Copy link
Contributor

@dumbbell
When moving completely from ant
Uncomment line 148 and remove line 147 in pom.xml

Have the right settings.xml in your ~/.m2 directory like

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
<servers>
    <server>
      <id>sonatype-nexus-staging</id>
      <username>my_login</username>
      <password>my_password</password>
    </server>
  </servers>
</settings>

To release a new version the maven commands would be:
mvn versions:set -DnewVersion=<new.version> && mvn versions:commit && mvn clean deploy

It would set the version in the pom and use that version in the generated java file.

By the way you can also run the perf tests like this
mvn -q exec:java -Dexec.classpathScope=test -Dexec.mainClass="com.rabbitmq.examples.PerfTest"

or with arguments

mvn -q exec:java -Dexec.classpathScope=test -Dexec.mainClass="com.rabbitmq.examples.PerfTest" -Dexec.args="arg0 arg1 arg2" 

Basically any class with a main inside package com.rabbitmq.examples without the need to moving any jar around, the classpath is defined by maven.

I added a runperftestMaven.sh and stresspersisterMaven.sh inside the script folder.

One last thing I can write an assembly to build a zip to run perf tests that would contain all the necessary files.

It would contain a single jar and the necessary .sh/.bat files

@michaelklishin
Copy link
Contributor Author

@PatrickSauts note that we also distribute the JAR directly from GitHub and rabbitmq.com. But

mvn versions:set -DnewVersion=<new.version> && mvn versions:commit

certainly sounds right up our alley, thank you!

@PatrickSauts
Copy link
Contributor

@michaelklishin You probably want to build the jars using maven too right ?

mvn versions:set -DnewVersion=<new.version> && mvn versions:commit && mvn clean package

I'm pretty sure that was implicit in your comment but just in case.

So moving ~completely away from ant you could get rid of lib and bundlor folders, all bundlor files and build.xml.

Your very welcome. Glad I could help.

@michaelklishin
Copy link
Contributor Author

@PatrickSauts sure, thank you. We will ping you once we have more Maven questions (which should be around the time 3.7.0 Milestone 2 ships, so in about a month).

acogoluegnes added a commit to acogoluegnes/rabbitmq-java-client that referenced this pull request Aug 23, 2016
As the activation cannot use properties in the file tag.

Issue rabbitmq#122
@acogoluegnes acogoluegnes deleted the rabbitmq-java-client-37 branch March 21, 2019 08:27
stream-iori pushed a commit to stream-iori/rabbitmq-java-client that referenced this pull request Mar 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants