________________________________ From: ahardy42 <adam.ha...@cyberspaceroad.com> Sent: Friday, January 5, 2018 8:38 AM To: users@maven.apache.org Subject: Unexplained sudden loss of access to repository on build server
I'm testing parts of my mojo in an integration test and for months this worked fine locally and on the build server (Teamcity). I specified our company's artifactory repository in the settings.xml I created a test project in the src/test/resources/my-test-project directory and referred to it using the AbstractMojoTestCase#getTestProject() method. I specified a particular dependency required only by the mojo in the plugin dependency block in the test project pom.xml. This all worked fine and maven retrieved the dependency and the tests ran. Now suddenly, the tests break on the build server because maven is ignoring the settings.xml configured for the build, and is searching repo.maven.apache.org for the test dependency. Locally it still works fine. I have worked around it by adding the repository definitions from settings.xml into the test pom.xmls directly, but obviously that's undesirable from a maintenance perspective. This is what it's doing: /** * Injected from Plexus container on start. */ @Component private RepositorySystem repositorySystem; /** * The current repository/network configuration of Maven. */ @Parameter(defaultValue = "${repositorySystemSession}", readonly = true) private RepositorySystemSession repositorySystemSession; MG>so repositorySystemSession is null?.. did you try putting maven-plugin-api into your dependencies? https://github.com/sonatype/aether-demo-maven-plugin/blob/master/pom.xml And then I'm resolving my desired artifact like this: ArtifactResult result = repositorySystem.resolveArtifact( repositorySystemSession, new ArtifactRequest( new DefaultArtifact(groupId, artifactId, null, type, version), project.getRemoteProjectRepositories(), null)); configArtifact = result.getArtifact(); -- Sent from: http://maven.40175.n5.nabble.com/Maven-Users-f40176.html Maven - Maven - Users | Mailing List Archive<http://maven.40175.n5.nabble.com/Maven-Users-f40176.html> maven.40175.n5.nabble.com This forum is an archive for the mailing list users@maven.apache.org (more options) Messages posted here will be sent to this mailing list. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org