mojohaus / exec-maven-plugin

Exec Maven Plugin
https://www.mojohaus.org/exec-maven-plugin/
Apache License 2.0
163 stars 95 forks source link

exec-maven-plugin ignores my company-local repository from settings.xml #67

Open PiotrMachner opened 7 years ago

PiotrMachner commented 7 years ago

In my company we're using an artifactory which everybody has configured as a repository in their own ~.m2\repository\settings.xml file (and this works).

But for some reason the exec-maven-plugin ignores / dislikes this repository. In my exec plugin configuration I've got a dependency that is in the mentioned repository:

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.3.2</version>
        <executions>
            ...
        </executions>
        <dependencies>
            <dependency>
                <groupId>com.sencha.gxt</groupId>
                <artifactId>gxt-themebuilder</artifactId>
                <version>3.1.4</version>
            </dependency>
        </dependencies>
    </plugin>

and when I run the build, maven correctly resolves the dependency from the company repository but the exec plugin fails after trying to get the dependency from the global maven repositories (but not from the company repository):

» mvn clean install                                                                                                                                     
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.pom (11 KB at 11.4 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-parent/3.1.4/gxt-parent-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-parent/3.1.4/gxt-parent-3.1.4.pom (15 KB at 45.1 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.pom
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.pom (7 KB at 29.6 KB/sec)
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar
Downloading: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar (1719 KB at 766.7 KB/sec)
Downloaded: http://maven.my-company-artifactory.nil:8081/artifactory/sencha-commercial-release/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar (3706 KB at 852.4 KB/sec)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ my-project ---
[INFO] Deleting C:\workspace\MyProject\target
[INFO]
[INFO] --- maven-download-plugin:1.1.0:wget (download-phantomjs) @ my-project ---
[INFO] Got from cache: C:\Users\machner\.m2\repository\.cache\maven-download-plugin\phantomjs-1.9.6-windows.zip
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (generate-my-project-gen) @ my-project ---
Downloading: http://repo.maven.apache.org/maven2/com/sencha/gxt/gxt-themebuilder/3.1.4/gxt-themebuilder-3.1.4.jar
Downloading: http://repo.maven.apache.org/maven2/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
Downloading: https://oss.sonatype.org/content/repositories/google-snapshots/com/sencha/gxt/gxt/3.1.4/gxt-3.1.4.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.770s
[INFO] Finished at: Wed Oct 26 16:44:23 CEST 2016
[INFO] Final Memory: 11M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (generate-my-project-gen) on project my-project: Execution generate-my-project-gen of goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java failed: Plugin org.codehaus.mojo:exec-maven-plugin:1.3.2 or one of its dependencies could not be resolved: The following artifacts could not be resolved: com.sencha.gxt:gxt-themebuilder:jar:3.1.4, com.sencha.gxt:gxt:jar:3.1.4: Could not find artifact com.sencha.gxt:gxt-themebuilder:jar:3.1.4 in central (http://repo.maven.apache.org/maven2) -> [Help 1]

When inside my local repository I delete the _remote.repositories files for my dependency as suggested here the build passes. So it appears as if the exec plugin for some reason 'disliked' the company repository.

Any help would be appreciated. Thanks, Piotr

ikysil commented 7 years ago

Hi Piotr,

secustor commented 6 years ago

@ikysil I have the same problem as @PiotrMachner. Neither I use includePluginDependencies nor executeableDependency.

cima commented 5 years ago

For me it helped to introduce our company repository also in pluginRepositories section. Despite the dependency for a plugin looks like a regular dependency it is being searched in plugin repository which is by default central maven repository. See Getting Maven missing dependency errors when compiling ...