mavenix icon indicating copy to clipboard operation
mavenix copied to clipboard

passing maven flags, and postUnpack

Open deliciouslytyped opened this issue 5 years ago • 4 comments

I'm not sure where else to ask this; I'm trying to build https://github.com/sismics/docs and it says to pass -Pprod and run mvn -Pprod -DskipTests clean install from the docs-web directory, but setting

  postUnpack = ''
    cd source/docs-web
    sleep 1000;
    '';

in the default.nix generated by mavenix doesn't seem to do anything, and setting MAVEN_OPTS = "-Pprod"; causes:

 mvnix-update

  Getting mavenix meta data...

/nix/store/4rcdfir519a8pc8n26472ik35gl4lddn-mk-repo
/nix/store/9nchmr86bcqjmp0dilcp1lwp5yvcc64v-settings.xml
warning: you did not specify '--add-root'; the result might be removed by the garbage collector

  Running mvn package...

warning: ignoring the user-specified setting 'show-trace', because it is a restricted setting and you are not a trusted user
Unrecognized option: -Pprod
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

What's the correct way to do this? (I don't really know anything about maven) I imagine I'm passing -Pprod in the wrong place.

deliciouslytyped avatar Feb 12 '20 18:02 deliciouslytyped

So, I think doing something 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
                          http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <activeProfiles>
      <activeProfile>prod</activeProfile>
    </activeProfiles>
    </settings>

solves the -Pprod problem.

deliciouslytyped avatar Feb 12 '20 20:02 deliciouslytyped

The postUnpack problem still remains, but in a different way now: I need to deal with preparing some nodejs stuff in the build, and I'd want to put some code in postUnpack for that.

deliciouslytyped avatar Feb 12 '20 20:02 deliciouslytyped

I see. mvnix-update sets -E '(import "/some/path/default.nix" {}).overrideAttrs (_: { build = false; })'. That leaves me confused however. If that's disabled, why and how does maven build?

-> The answer is that this is being run in a nix shell and it's just getting the appropriate environment. I should probably be patching the src derivation.

deliciouslytyped avatar Feb 12 '20 22:02 deliciouslytyped

I dirty/shitty hack is to override the buildPhase.

ajs124 avatar Apr 22 '20 23:04 ajs124