Nexus repository contains artifact but only makes POM available - maven-2

I have a Nexus instance with Maven 2 repositories hosted on a non-Internet-connected corporate development domain. I need to use the maven-jaxb-schemagen plugin from Sun, however, it was only available in Maven 1 format (along with many other Maven 1 dependencies, so this is not a one-off edge case).
I made a new Maven 1 hosted repository in Nexus (maven1), then made a Maven1-to-Maven2 virtual repository as well (maven1as2). Because some of the needed artifacts are snapshots, the policy for maven1 (and by extension maven1as2) is Snapshot.
I imported all of the Maven 1 artifacts through the filesystem to this repository's overridden local storage location.
I then added maven1as2 to my Public Repositories group. Some of the reference I have found says that Nexus will not allow you to browse or search a Maven1 repository. I have had mixed results. If I select Public Repositories or maven1as2 in Nexus, I can go to Browse Storage and drill down to com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/ and view the maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom file and its checksum. However, I cannot view the JAR artifact that should be there and is on the filesystem.
When I try to use Maven to build, I get the following:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] MyProject
[INFO] MyModule1
[INFO] MyModule2
...
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [cobertura:clean {execution: default}]
[INFO] No goals needed for project - skipping
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyModule1
[INFO] task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
Downloading: http://my.nexus.server:8081/nexus/content/groups/public/com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom
6K downloaded (maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom)
[INFO] ---------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ---------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file -Durl=[url] -DrepositoryId=[id]
com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT
from the specified remote repositories:
nexus (http://my.nexus.server:8081/nexus/content/groups/public)
com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT
from the specified remote repositories:
nexus (http://my.nexus.server:8081/nexus/content/groups/public)
[INFO] ---------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ---------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jul 06 15:05:08 EDT 2010
[INFO] Final Memory: 7M/17M
[INFO] ---------------------------------------------------------------------------

Sometimes it happens when working with m2eclipse. You chose a dependency and the default scope is pom and not jar. You didn't show your pom file. validate that all dependencies are jar scoped.

I learned that most of the time rebuilding metadata of the repositories helps to solve such problems.
I find it annoying how often this is necessary.
Select the repository
In the "Browse Storage" tab open the context menu of the root node (it sometimes is hidden behind the Firefox default context menu - pressing Esc helps in this case and brings the Nexus context menu into view)
Select rebuild metadata
Expire cache and reindex may help too for some cases.
Most of the time these steps didn't solve the problem at the first try but at last they solved it each time though.
I run Nexus as a WAR in Glassfish 2.1

Related

Automation test report issues with JENKINS/MAVEN/ECLIPSE

I am facing issues while generating reports after successful build using maven in jenkins.
First, I have created java code into my local machine using eclipse.
Second, After creating the code I converted it to the Maven and completed all required setup of pom.xml file inside jenkins using Maven.
Third, I ran the script it gives me the success response.
Below, it is my maven success build result logs.
Started by user jenkin
Building in workspace /var/lib/jenkins/workspace/TestProject
Parsing POMs
Modules changed, recalculating dependency graph
Established TCP socket on 35275
[TestProject01] $ java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.12.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven1/boot/plexus-classworlds-2.5.2.jar:/var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven1/conf/logging jenkins.maven3.agent.Maven35Main /var/lib/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven1 /var/cache/jenkins/war/WEB-INF/lib/remoting-3.27.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.12.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.12.jar 35275
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /home/user/Documents/eclipse-workspace/TestProject01/pom.xml clean install
[INFO] Scanning for projects...
[HUDSON] Collecting dependencies info
[INFO]
[INFO] ------------------< TestProject01:TestProject01 >-------------------
[INFO] Building TestProject01 0.0.1-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # TestProject01 ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # TestProject01 ---
[INFO] Installing /home/user/Documents/eclipse-workspace/TestProject01/pom.xml to /var/lib/jenkins/.m2/repository/TestProject01/TestProject01/0.0.1-SNAPSHOT/TestProject01-0.0.1-SNAPSHOT.pom
[WARNING] Attempt to (de-)serialize anonymous class org.jfrog.hudson.maven2.MavenDependenciesRecorder$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO]
[INFO] BUILD SUCCESS
[INFO] Total time: 2.821 s
[INFO] Finished at: 2019-02-05T19:09:16+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/user/Documents/eclipse-workspace/TestProject01/pom.xml to TestProject01/TestProject01/0.0.1-SNAPSHOT/TestProject01-0.0.1-SNAPSHOT.pom
/home/user/Documents/eclipse-workspace/TestProject01/pom.xml is not inside /var/lib/jenkins/workspace/TestProject/home/user/Documents/eclipse-workspace/TestProject01/; will archive in a separate pass
channel stopped
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /home/user/Documents/eclipse-workspace/TestProject01/test-output to /var/lib/jenkins/jobs/TestProject/htmlreports/HTML_20Report
Finished: SUCCESS
Now, The issue is I do not know how can I check if all testcases covered with success. Here, HTML report been generated but it stays the same after every build success which creating lot of confusion.
Please help!!!!!!!!

Apache Isis build failure migrating from v1.12.2. Unknown repositories ApplicationUser,

I am migrating an Apache Isis application from version 1.12.2 and currently using the legacy addons Security, Audit, and SessionLogger. I plan on updating to the latest Isis version and using the latest Incode addons here.
When changing the Isis version to 1.13.0 it fails the build. I did not see anything in the migration notes that will fix this. The build error is unkown repository for ApplicationRole, ApplicationTenancy, ApplicationUser. The bootstrap class lists the addon modules and there are no errors using Isis 1.12.2.
(update)
I thought it possible that Isis and the Incode addons should upgrade together at some point and someone would mention it, but I wasn't sure. Then looking more into this, I noticed the Apache Isis isis-app-todoapp uses an Isis version one major release higher, as well as the Incode addons, which are also one major release higher than what I have. Any idea about this? I would like to get to the latest Isis and Incode versions.
[ERROR]
[ERROR] #DomainObject annotation on org.isisaddons.module.security.dom.role.ApplicationRole specifies unknown repository 'org.isisaddons.module.security.dom.role.ApplicationRoleRepository'
[ERROR] #DomainObject annotation on org.isisaddons.module.security.dom.tenancy.ApplicationTenancy specifies unknown repository 'org.isisaddons.module.security.dom.tenancy.ApplicationTenancyRepository'
[ERROR] #DomainObject annotation on org.isisaddons.module.security.dom.user.ApplicationUser specifies unknown repository 'org.isisaddons.module.security.dom.user.ApplicationUserRepository'
[ERROR]
[ERROR]
[INFO] calling #PreDestroy on all domain services
[INFO] shutting down
org.apache.isis.core.metamodel.specloader.SpecificationLoader#1e2fe282
[INFO] ---------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] App ................................. SUCCESS [ 0.652s]
[INFO] App DOM ............................. FAILURE [ 37.945s]
[INFO] App Fixtures ........................ SKIPPED
[INFO] App App ............................. SKIPPED
[INFO] App Webapp .......................... SKIPPED
[INFO] ---------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.974 s
[INFO] Finished at: 2018-05-25T09:47:05-04:00
[INFO] Final Memory: 84M/692M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.isis.tool:isis-maven-plugin:1.13.2:validate (default) on project App-dom: 3 meta-model problems found. -> [Help 1]
[ERROR]
Solved by removing a maven build-profile slash validation step, after reading similar SO question, and updating the Incode addon modules with each major Isis release. I successfully went through Apache Isis release 1.13.0, 1.14.0, 1.15.0, 1.16.2.

error in deploying jar to remote repository in maven

i am trying to deploy a jar file from my local machine to a remote machine which has an artifactory. I tried the following command :
mvn deploy:deploy-file -DgroupId=<some-id>
-DartifactId=<some-artifact>
-Dversion=<version>
-Dpackaging=jar
-Dfile=<path to the file in my local system>
-Durl=http://<ip of remote machine>:<port>/artifactory/repo/
-DrepositoryId=<artifactory -id in remote machine>
but on executing it gives error that:
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] -----------------------------------------------------------------------
[INFO] Building Maven Default Project
[INFO] task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] -----------------------------------------------------------------------
[INFO] -----------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] -----------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'deploy:
ploy-file'
[0] Inside the definition for plugin 'maven-deploy-plugin' specify the following
:
<configuration>
...
<url>VALUE</url>
</configuration>
-OR-
on the command line, specify: '-Durl=VALUE'
As i am specifying the value for Durl in my command why am i still getting this error?
How to resolve this?
The maven version is 2.2.1
Thanks.
Answered in comments:
Not sure about the Maven error itself, but I did notice that the
deployment URL points to Artifactory's "/repo" repository (which is a
global virtual aggregator of all the repositories in the instance);
since it's a virtual repository, one cannot deploy to it; you should
point the URL to one of Artifactory's local repositories
(libs-release-local, etc.). – noamt Jan 20 '12 at 8:44
i changed it to local repo name but still same error – pranay Jan 20
'12 at 13:02
yes i got it wokring now..actually was putting the wrong url ..thanks
a lot – pranay Jan 25 '12 at 6:33

Error While Test The Project On Maven

i am using maven i don't have more knowledge about maven when i am install my project then it will successfully build but when i am test my project with maven it will give me an error like
Unable to copy an artifact to the working directory
i gave all permission to my project directory detail error as below so how can i resolve my
problem and how to run my project
so please help me
E
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 minute 24 seconds
[INFO] Finished at: Thu Jan 27 17:44:59 IST 2011
[INFO] Final Memory: 35M/84M
[INFO] ------------------------------------------------------------------------
[INFO] Unable to copy an artifact to
the working directory Embedded error:
/home/nayan/workspace/ONiT/mediaPlayer/target/classes
(Is a directory) [INFO]
This looks like some of the previous tests are still running at this point and blocking maven from writing in the target directory.
As this seems to be an reactor build, do the modules themself build correctly ? I.e. can you run mvn test in each module directory seperately ?

Maven FTP distribution problem

maven release:perform is failing to distribute via FTP.
The first thing I checked is that I can access the target server with the given credentials from the command line. I can with passive FTP but not with active FTP (known firewall restriction). What I can see from googling is that Maven uses passive FTP by default. Is that correct? If not, how can I cause it to use passive FTP?
Assuming Maven is using passive FTP, I would appreciate any other advice.
My configuration:
settings.xml:
<servers>
<server>
<id>repo-ftp</id>
<username>myUserName</username>
<password>myPassword</password>
</server>
</servers>
parent POM:
<distributionManagement>
<repository>
<id>repo-ftp</id>
<url>ftp://myServer</url>
</repository>
<snapshotRepository>
<id>repo-ftp</id>
<url>ftp://myServer</url>
</snapshotRepository>
</distributionManagement>
The error message:
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] FATAL ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] org.apache.maven.wagon.AbstractWagon.openConnection()V
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Trace
[INFO] java.lang.AbstractMethodError: org.apache.maven.wagon.AbstractWagon.openConnection()V
[INFO] at org.apache.maven.wagon.AbstractWagon.connect(AbstractWagon.java:143)
[INFO] at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:235)
[INFO] at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:153)
[INFO] at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:80)
[INFO] at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:162)
[INFO] at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
[INFO] at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
[INFO] at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
[INFO] at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
[INFO] at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[INFO] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[INFO] at java.lang.reflect.Method.invoke(Method.java:616)
[INFO] at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
[INFO] at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
[INFO] at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
[INFO] at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 16 seconds
[INFO] [INFO] Finished at: Wed Oct 21 17:43:11 UTC 2009
[INFO] [INFO] Final Memory: 25M/47M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Maven execution failed, exit code: '1'
UPDATE
I did have an extension node in the parent POM:
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-5</version>
</extension>
After reviewing the reply from cetnar I realized that I need beta-2 for my particular version of maven. When I switched the extension node to reference beta-2, maven properly complained about not having it available. So, I downloaded and installed using
mvn install:install-file -DgroupId=org.apache.maven.wagon -DartifactId=wagon-ftp -Dversion=1.0-beta-2 -Dpackaging=jar -Dfile=./wagon-ftp-1.0-beta-2-sources.jar
(which is a cut-and-paste from the error message I got, with my local copy of the .jar in the appropriate location).
Now, I get:
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] BUILD ERROR
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Error deploying artifact: Unsupported Protocol: 'ftp': Cannot find wagon which supports the requested protocol: ftp
[INFO]
[INFO] Component descriptor cannot be found in the component repository: org.apache.maven.wagon.Wagonftp.
Any advice for that problem?
UPDATE 2
I did not have wagon-ftp.jar or commons-net.jar in $M2_HOME/lib but do now. I get the same error.
$M2_HOME/lib:
commons-cli.jar -> ../../java/commons-cli.jar
commons-net.jar -> ../../java/commons-net.jar
doxia-sink-api.jar -> ../../java/doxia-sink-api.jar
jsch.jar -> ../../java/jsch.jar
jtidy.jar -> ../../java/jtidy.jar
maven2.jar -> ../../java/maven2.jar
plexus-container-default.jar -> ../../java/plexus-container-default.jar
plexus-interactivity-api.jar -> ../../java/plexus-interactivity-api.jar
plexus-utils.jar -> ../../java/plexus-utils.jar
wagon-file.jar -> ../../java/wagon-file.jar
wagon-ftp-1.0-beta-2.jar -> ../../java/wagon-ftp.jar
wagon-ftp.jar -> ../../java/wagon-ftp.jar
wagon-http-lightweight.jar -> ../../java/wagon-http-lightweight.jar
wagon-http-shared.jar -> ../../java/wagon-http-shared.jar
wagon-provider-api.jar -> ../../java/wagon-provider-api.jar
wagon-ssh-common.jar -> ../../java/wagon-ssh-common.jar
wagon-ssh-external.jar -> ../../java/wagon-ssh-external.jar
wagon-ssh.jar -> ../../java/wagon-ssh.jar
xml-apis.jar -> ../../java/xml-apis.jar
Note that all other dependencies were deployed using symbolic links to another directory so I continued the same pattern. Access rights are the same for all files. I tried providing both a wagon-ftp.jar and wagon-ftp-1.0-beta-2.jar symbolic link.
I'm not very excited about the prospect of upgrading to the latest version of maven (for fear of new problems), but is that my best option? Any other ideas?
SOLUTION
It worked! Kind of. Now I get an authentication error, but that's a different issue.
The a-ha moment was the mention of -sources and I realized I had downloaded wagon-ftp-1.0-beta-2-sources.jar but installed with -Dversion=1.0-beta-2 (no -sources)... so I copied the sources JAR to the binary jar file name :-).
Thank you all for your help with this!
The setup looks good. And yes, passive mode is the default (see WAGON-143). That said, according to the trace (java.lang.AbstractMethodError is thrown when something tries to call an abstract method), it's obvious that your wagon isn't compatible with your version of maven. Wagon madness...
It's surely not the best place but this is actually documented in the Guide to using Extenstions (pay a special attention to the "Note" at the bottom):
Extensions are used to enable Wagon
providers, used for the transport of
artifact between repositories, and
plug-ins which provide lifecycle
enhancements. Wagon providers
<project>
...
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-beta-2</version>
</extension>
</extensions>
</build>
...
</project>
Note: Wagon 1.0-beta-3+ requires Maven 2.1.0 or above. For Maven 2.0.10
and earlier, use Wagon 1.0-beta-2.
EDIT: About the new error, the maven deploy plugin FAQ describes something very similar:
If you are using the deploy:deploy-file goal and encounter this error:
"Error deploying artifact: Unsupported Protocol: 'ftp': Cannot find wagon which supports the requested protocol: ftp"
Then you need to place the appropriate wagon provider in your %M2_HOME%/lib. In this case the provider needed is ftp, so we have to place the wagon-ftp jar in the lib directory of your Maven 2 installation.
If the error description is something like this:
"Error deploying artifact: Unsupported Protocol: 'ftp': Cannot find wagon which supports the requested protocol: ftp org/apache/commons/net/ftp/FTP"
Then you need to place the commons-net jar in %M2_HOME%/lib.
I don't get why one would have to do that but try to put wagon-ftp-1.0-beta-2.jar in %M2_HOME%/lib.
EDIT2: I've read the question again and it looks like you did install a "sources" jar which, of course, doesn't contain the required classes for the runtime. Before following the advice above, try to put wagon-ftp-1.0-beta-2.jar in your repository (and not wagon-ftp-1.0-beta-2-sources.jar).
Did you define wagon-ftp as a extension in your pom?
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0-alpha-3</version>
</extension>
</extensions>
If yes I thing the problem is in wrong versions maven and wagon-ftp. Here is one article about this problem.
In maven-user-list I found that you need to use 1.0-beta-2 of the ftp wagon with 2.0.9. 1.0-beta-3 will work with 2.0.10 and Wagon 1.0-beta-5 release will only work as an extension in Maven 2.1.0-M1 and above.