Comments (13)
Please run mvn with '-X' option. This will enable debugging output. What values are being passed to the plugin?
from exists-maven-plugin.
Based on your suggestion, I've tweaked my calls but still no luck:
mvn -X org.honton.chas:exists-maven-plugin:remote -Dexists.failIfExists=true -Dexists.skipIfSnapshot=false
...
[DEBUG] Configuring mojo 'org.honton.chas:exists-maven-plugin:0.6.0:remote' with basic configurator -->
[DEBUG] (f) artifact = mock-java-shared-library-0.0.1-SNAPSHOT.jar
[DEBUG] (f) cmpChecksum = false
[DEBUG] (f) failIfExists = true
[DEBUG] (f) failIfNotExists = false
[DEBUG] (f) failIfNotMatch = true
[DEBUG] (f) mavenProject = MavenProject: com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT @ C:\Code\mock\Bitbucket\mock-java-shared-library\pom.xml
[DEBUG] (f) project = com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT
[DEBUG] (f) property = maven.deploy.skip
[DEBUG] (f) repository = https://artifact.nurocorinternal.com/repository/maven-releases
[DEBUG] (f) serverId = com.nurocor.repo.releases
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@6f952d6c
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@5965844d
[DEBUG] (f) skip = false
[DEBUG] (f) skipIfSnapshot = false
[DEBUG] (f) snapshotRepository = https://artifact.nurocorinternal.com/repository/maven-snapshots
[DEBUG] (f) snapshotServerId = com.nurocor.repo.snapshots
[DEBUG] (f) userProperty = false
[DEBUG] -- end configuration --
[DEBUG] Checking for artifact at https://artifact.nurocorinternal.com/repository/maven-snapshots/com/nurocor/mock/mock-java-shared-library/0.0.1-SNAPSHOT/mock-java-shared-library-0.0.1-SNAPSHOT.jar
[DEBUG] no server configuration
[INFO] com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT does not exist
However, I know the file does exist in our Nexus repo:
The problem seems to be that it is checking the wrong URL for the JAR file since it is getting a timestamp attached.
from exists-maven-plugin.
Have you configured the plugin with per-execution configuration or global confguration?
<plugin>
<groupId>org.honton.chas</groupId>
<artifactId>exists-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>remote</goal>
</goals>
<configuration>
<!-- per-execution configuration -->
</configuration>
</execution>
</executions>
<configuration>
<!-- global configuration -->
</configuration>
</plugin>
from exists-maven-plugin.
Neither. As I said in the post, I'm making this call purely from a CLI with no POM configuration at all.
from exists-maven-plugin.
Looks like this is probably a duplicate of #26.
Checking for artifact at https://artifact.nurocorinternal.com/repository/maven-snapshots/com/nurocor/mock/mock-java-shared-library/0.0.1-SNAPSHOT/mock-java-shared-library-0.0.1-SNAPSHOT.jar
That is not the URL to the artifact.
from exists-maven-plugin.
Probably. Snapshots are difficult to deal with. How do we determine if a particular snapshot is current? Each deploy of a snapshot creates a new timestamped suffix. What timestamp should we use? If we use latest timestamp in remote repository, what local timestamp to use?
You may wish to experiment with hash comparison instead. (Which introduces its own set of problems.)
from exists-maven-plugin.
For your use case, perhaps knowledge that any snapshot version exists is sufficient?
from exists-maven-plugin.
Yes, that would be a fair statement.
from exists-maven-plugin.
It also seems that you cannot override the fact that the pom version lists as a SNAPSHOT. For example, I tried this:
mvn -X build-helper:parse-version org.honton.chas:exists-maven-plugin:remote -Dexists.failIfExists=true -Dexists.artifact='${project.artifactId}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.{project.packaging}'
...
[DEBUG] Configuring mojo 'org.honton.chas:exists-maven-plugin:0.6.0:remote' with basic configurator -->
[DEBUG] (f) artifact = 'mock-java-shared-library-0.0.1.jar'
[DEBUG] (f) cmpChecksum = false
[DEBUG] (f) failIfExists = true
[DEBUG] (f) failIfNotExists = false
[DEBUG] (f) failIfNotMatch = true
[DEBUG] (f) mavenProject = MavenProject: com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT @ C:\Code\mock\Bitbucket\mock-java-shared-library\pom.xml
[DEBUG] (f) project = com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT
[DEBUG] (f) property = maven.deploy.skip
[DEBUG] (f) repository = https://artifact.nurocorinternal.com/repository/maven-releases
[DEBUG] (f) serverId = com.nurocor.repo.releases
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@7d070ef5
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@7a55f148
[DEBUG] (f) skip = false
[DEBUG] (f) skipIfSnapshot = true
[DEBUG] (f) snapshotRepository = https://artifact.nurocorinternal.com/repository/maven-snapshots
[DEBUG] (f) snapshotServerId = com.nurocor.repo.snapshots
[DEBUG] (f) userProperty = false
[DEBUG] -- end configuration --
[DEBUG] skipping -SNAPSHOT
Even though my pom.xml lists the project as a SNAPSHOT, I would have expected this to check for the artifact listed in exists.artifact
. Instead, it skipped because the pom.xml has a snapshot version.
I then tried adding skipIfSnapshot
and this seems to get further but still do something unexpected:
mvn -X build-helper:parse-version org.honton.chas:exists-maven-plugin:remote -Dexists.failIfExists=true -Dexists.artifact='${project.artifactId}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${project.packaging}' -Dexists.skipIfSnapshot=true
...
[DEBUG] Configuring mojo 'org.honton.chas:exists-maven-plugin:0.6.0:remote' with basic configurator -->
[DEBUG] (f) artifact = 'mock-java-shared-library-0.0.1.jar'
[DEBUG] (f) cmpChecksum = false
[DEBUG] (f) failIfExists = true
[DEBUG] (f) failIfNotExists = false
[DEBUG] (f) failIfNotMatch = true
[DEBUG] (f) mavenProject = MavenProject: com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT @ C:\Code\mock\Bitbucket\mock-java-shared-library\pom.xml
[DEBUG] (f) project = com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT
[DEBUG] (f) property = maven.deploy.skip
[DEBUG] (f) repository = https://artifact.nurocorinternal.com/repository/maven-releases
[DEBUG] (f) serverId = com.nurocor.repo.releases
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@62566842
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@2f1ea80d
[DEBUG] (f) skip = false
[DEBUG] (f) skipIfSnapshot = false
[DEBUG] (f) snapshotRepository = https://artifact.nurocorinternal.com/repository/maven-snapshots
[DEBUG] (f) snapshotServerId = com.nurocor.repo.snapshots
[DEBUG] (f) userProperty = false
[DEBUG] -- end configuration --
[DEBUG] Checking for artifact at https://artifact.nurocorinternal.com/repository/maven-snapshots/com/nurocor/mock/mock-java-shared-library/0.0.1-SNAPSHOT/'mock-java-shared-library-0.0.1.jar'
[DEBUG] no server configuration
[INFO] com.nurocor.mock:mock-java-shared-library:0.0.1-SNAPSHOT does not exist
This looks like it used the expected artifact
property for the check, but did so inside a snapshot directory. So there's not way to use this and check for a version not listed in the POM? In our particular use case, we would want to prevent someone from publishing a snapshot on a version if the release has already been published. This plugin seemed like a great way to do that, but it seems that is impossible without actively changing the POM before using the plugin.
Incidentally, your README file has a slight typo:
Pretty sure that should read as ${project.packaging}
from exists-maven-plugin.
Please try version 0.7.0 to see if this satisfies your use case.
from exists-maven-plugin.
I'm unclear from the change log what has actually changed or how I would leverage it.
from exists-maven-plugin.
I don't think 0.7.0 did much of anything to help if I'm understanding the fix. I did:
mvn -X build-helper:parse-version org.honton.chas:exists-maven-plugin:0.7.0:remote -Dexists.failIfExists=true -Dexists.artifact='${project.artifactId}-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${project.packaging}' -Dexists.skipIfSnapshot=true
...
[DEBUG] Configuring mojo org.honton.chas:exists-maven-plugin:0.7.0:remote from plugin realm ClassRealm[plugin>org.honton.chas:exists-maven-plugin:0.7.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@73d16e93]
[DEBUG] Configuring mojo 'org.honton.chas:exists-maven-plugin:0.7.0:remote' with basic configurator -->
[DEBUG] (f) artifact = 'mock-java-backend-service-0.0.1.jar'
[DEBUG] (f) cmpChecksum = false
[DEBUG] (f) failIfExists = true
[DEBUG] (f) failIfNotExists = false
[DEBUG] (f) failIfNotMatch = true
[DEBUG] (f) mavenProject = MavenProject: com.nurocor.mock:mock-java-backend-service:0.0.1-SNAPSHOT @ C:\Code\mock\Bitbucket\mock-java-backend-service\pom.xml
[DEBUG] (f) project = com.nurocor.mock:mock-java-backend-service:jar:0.0.1-SNAPSHOT
[DEBUG] (f) property = maven.deploy.skip
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@2d7a9786
[DEBUG] (f) settings = org.apache.maven.execution.SettingsAdapter@7bab5898
[DEBUG] (f) skip = false
[DEBUG] (f) skipIfSnapshot = true
[DEBUG] (f) userProperty = false
[DEBUG] -- end configuration --
[DEBUG] skipping -SNAPSHOT
This now appears to have ignored exists.artifact
property entirely and only used the values in the POM. Because skipIfExists
was set, it skipped the check instead of using exists.artifact
. This is the opposite of what would be helpful for my use case. I effectively need to provide all the data on the command line and not use the POM at all.
It doesn't seem like this plugin is useful for my intended purpose, which seems a little odd considering the purpose is to "check if some artifact exists". The fundamental impedance mismatch is that your "artifact" property is the name of the JAR file. This is quite a bit different than standard plugins like Maven Dependency plugin. Take, for example dependency:copy
(https://maven.apache.org/plugins/maven-dependency-plugin/copy-mojo.html). In this plugin, artifact
represents the full artifact identifier (groupId:artifactId:version[:packaging[:classifier]]
), not the "JAR" file name. The JAR file name is usually constructed from those values, not the other way around. In this plugin, there is no such ability to specify the real artifact by ID. It relies on the POM for that data and then allows you to override only the name of the resulting JAR.
from exists-maven-plugin.
Did you want exists.skipIfSnapshot
to be true or false?
There does appear to be a defect in that SNAPSHOT is determined by project rather than by given exists.artifact
, so I recommend trying with exists.skipIfSnapshot=false
from exists-maven-plugin.
Related Issues (20)
- Duplicated results in a multi-project HOT 1
- Make exists goal thread-safe HOT 1
- Authentication not passed properly into wagon when using encryption in settings.xml
- Remote checks fails because of missing security file
- Question : profile activation HOT 1
- SNAPSHOT check exists HOT 2
- The artifact exists, but the plugin says otherwise HOT 2
- Provide option to skip remote check if deploy lifecycle is not executed HOT 1
- Checking an artifact with pom packaging fails HOT 3
- How to handle .bundle? HOT 2
- Version 0.7.0 doesn't work when using Amazon S3 HOT 8
- Did you intend to abandon Java 8 support? HOT 1
- Check if artifact exists in remote repository not working for test-jar HOT 11
- Version 0.9.0 - cmpChecksum doesn't work when using Amazon S3 HOT 4
- Not detecting artifacts with packaging maven-plugin HOT 2
- Looking for the wrong artifact when using <packaging>content-package</packaging> HOT 2
- failure with `Cannot invoke "String.length()" because "path" is null` HOT 6
- Wrong path in RemoteExistsMojo log printout
- failure when pom packaging HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exists-maven-plugin.