trustin / os-maven-plugin

A Maven plugin that sets various useful properties detected from ${os.name} and ${os.arch} properties.
Apache License 2.0
299 stars 64 forks source link

property not being evaluated as expected #8

Closed garypaduana closed 9 years ago

garypaduana commented 9 years ago

I have a parent project with modules. One of the modules declares the following in its pom file:

...
<build>
    <extensions>
        <extension>
            <groupId>kr.motd.maven</groupId>
            <artifactId>os-maven-plugin</artifactId>
            <version>1.2.3.Final</version>
        </extension>
    </extensions>
</build>
...
<dependencies>
    <dependency>
        <groupId>io.netty</groupId>
        <artifactId>netty-tcnative</artifactId>
        <version>${netty.tcnative.version}</version>
        <classifier>${os.detected.classifier}</classifier>
    </dependency>
</dependencies>    
...

This project will build successfully when mvn package is run from the parent project. I then want to use this submodule project as a dependency in some other gradle project so I install the parent project to my maven local repo and declare the dependency in my build.gradle file.

When building the gradle project I run into this error:

Could not resolve all dependencies for configuration ':runtime'.
> Could not find netty-tcnative-${os.detected.classifier}.jar (io.netty:netty-tcnative:1.1.33.Fork2).
    Searched in the following locations: https://repo.grails.org/grails/core/io/netty/netty-tcnative/1.1.33.Fork2/netty-tcnative-1.1.33.Fork2-${os.detected.classifier}.jar

Why is ${os.detected.classifier} not being evaluated? Thank you.

yeliaz commented 9 years ago

In IntelliJ, the Maven plugin does not properly detect and populate the ${os-detected-classifier} value. On my 64 bit system, It resolves it to windows-x86_32 not windows-x86_64. Setting -Dos.detected.classifier=windows-x86_64 in the idea.exe.vmoptions file did not help either. I had to manually set windows-x86_64 in all the places in the pom files where ${os-detected-classifier} was specified. Is there a fix planned? I am using the latest (1.2.3.Final).

trustin commented 9 years ago

@yeliaz It is because you are running the 32-bit version of IntelliJ IDEA. You can simply run idea64.exe and your problem should be gone. (That's how I use IntelliJ IDEA on Windows.)

trustin commented 9 years ago

@garypaduana os-maven-plugin does not support gradle. You could write one fairly easily though.

nmittler commented 9 years ago

For Gradle you can use https://github.com/google/osdetector-gradle-plugin, which is built on top of the os-maven-plugin.

trustin commented 9 years ago

@nmittler That's awesome. I've just added a link to it in README.md. :+1:

nmittler commented 9 years ago

@trustin +1 ... thanks buddy!

saborse commented 6 years ago

I tried to run by passing "-Dos.detected.classifier=windows-x86_64" to mvn clean package because as said above my itellij was not detecting it.

But still i am getting below error, Can anyone please help me resolving this ?

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.microbean:helm-maven-plugin:2.7.0.1.0.33:package (Package your-project chart) on project entity-search-service-helm: Not in GZIP format
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Not in GZIP format
        at org.microbean.helm.maven.PackageMojo.execute(PackageMojo.java:164)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
        ... 20 more
Caused by: java.util.zip.ZipException: Not in GZIP format
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:165)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:79)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:91)
        at org.microbean.helm.chart.URLChartLoader.toNamedInputStreamEntries(URLChartLoader.java:139)
        at org.microbean.helm.chart.URLChartLoader.toNamedInputStreamEntries(URLChartLoader.java:59)
        at org.microbean.helm.chart.StreamOrientedChartLoader.load(StreamOrientedChartLoader.java:207)
        at org.microbean.helm.chart.AbstractChartLoader.load(AbstractChartLoader.java:87)
        at org.microbean.helm.maven.PackageMojo.execute(PackageMojo.java:159)
        ... 22 more