petermr / ami3

Integration of cephis and normami code into a single base. Tests will be slimmed down
Apache License 2.0
17 stars 5 forks source link

What is the current command for ami image? #50

Closed mtdunstan closed 4 years ago

mtdunstan commented 4 years ago

What is the current syntax for running ami image? I tried:

Matthews-MBP-5:open-battery matthew$ ami -p liion image

Exception in thread "main" java.lang.NoSuchMethodError: 'picocli.CommandLine picocli.CommandLine.setUnmatchedOptionsAllowedAsOptionParameters(boolean)'
    at org.contentmine.ami.tools.AMI.createCommandLine(AMI.java:170)
    at org.contentmine.ami.tools.AMI.main(AMI.java:113)
remkop commented 4 years ago

Hi @mtdunstan, I have an idea how this could have happened:

Please Check

Can you check the files under $AMI_HOME/target/appassembler/repo, and see if both the old library picocli-4.3.2.jar and the new picocli-4.4.0.jar exist in that directory? Please let us know if that is the case.

If that happens, chances are the old library is loaded first, resulting in the error you saw.

One way this could have happened is if you updated to get the latest source, and then built with mvn package -DskipTests or mvn install -DskipTests.

How to Fix This

The fix is to build with mvn clean package -DskipTests or mvn clean install -DskipTests. The clean command will remove all old libraries before rebuilding.

We can then re-enable the new method setUnmatchedOptionsAllowedAsOptionParameters after verifying that only the new picocli-4.4.0.jar exist in the $AMI_HOME/target/appassembler/repo directory.

petermr commented 4 years ago

Good thinking: $AMI_HOME/target/appassembler/repo lists


picocli-4.2.0.jar

picocli-4.3.2.jar

picocli-4.4.0.jar

I will clean and re-install.

Query: Why does this happen? The POM only mentions 4.4.0. Presumably there is another class that loads 4.3.2 ? So this is an indirect load?

P.

On Tue, Jul 7, 2020 at 11:47 PM Remko Popma notifications@github.com wrote:

Hi @mtdunstan https://github.com/mtdunstan, I have an idea how this could happen: Please Check

Can you check the files under $AMI_HOME/target/appassembler/repo, and see if both the old library picocli-4.3.2.jar and the new picocli-4.4.0.jar exist in that directory? Please let us know if that is the case.

If that happens, chances are the old library is loaded first, resulting in the error you saw.

One way this could have happened is if you updated to get the latest source, and then built with maven package -DskipTests or maven install -DskipTests. How to Fix This

The fix is to build with maven clean package -DskipTests or maven clean install -DskipTests. The clean command will remove all old libraries before rebuilding.

We can then re-enable the new method setUnmatchedOptionsAllowedAsOptionParameters after verifying that only the new picocli-4.4.0.jar exist in the $AMI_HOME/target/appassembler/repo directory.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/petermr/ami3/issues/50#issuecomment-655175672, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFTCS2MGJH4D7BCSOR2YDDR2OQYNANCNFSM4OSXKL3Q .

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

remkop commented 4 years ago

No, I think the old jars will go away if you do mvn clean install. Let me know if I’m wrong. I often am. :-)

remkop commented 4 years ago

Why does this happen?

The old jars simply remained when we did mvn install -DskipTests (without clean).

petermr commented 4 years ago

Yes, they've gone! I didn't think about the problem - but I would anyway have assumed the versions were managed by $HOME/.m2 I probably don't clean frequently enough.

On Wed, Jul 8, 2020 at 11:23 AM Remko Popma notifications@github.com wrote:

Why does this happen?

The old jars simply remained when we did mvn install -DskipTests (without clean).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/petermr/ami3/issues/50#issuecomment-655431343, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFTCS72HSOP6FEB7OKFBKDR2RCIHANCNFSM4OSXKL3Q .

-- Peter Murray-Rust Founder ContentMine.org and Reader Emeritus in Molecular Informatics Dept. Of Chemistry, University of Cambridge, CB2 1EW, UK

remkop commented 4 years ago

Technical sidebar on mvn clean

Maybe useful for the wiki

$HOME/.m2 is where Maven will cache downloaded libraries. Classes are loaded from this cache during the build. This directory never gets cleaned by Maven.

AMI's Maven configuration (pom.xml) contains the appassembler-maven-plugin. This will create the $AMI_HOME/target/appassembler/ directory, and copy libraries (with the version from our pom.xml) from $HOME/.m2 into the $AMI_HOME/target/appassembler/repo directory. If we use the mvn command without clean, the repo directory will still contain libraries from previous builds.

mvn clean will delete the $AMI_HOME/target build directory completely, before doing any other build step. This removes all artifacts from previous builds. Using mvn clean install instead of mvn install is recommended.

remkop commented 4 years ago

Closing this ticket; I haven't had feedback but I assume the problem was resolved (feel free to reopen or create another ticket if something comes up).

We made an improvement in ami: you no longer need to build from source. ami is now available as a zip file with the launcher scripts and jar file from https://github.com/petermr/ami3/packages/

That should help prevent issues like this.