I'm not able to build a project using a maven repository on a linux server. I'm using the same repository on my windows pc and I am able to build it.
WARN The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for com.fasterxml.jackson.core:jackson-core:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
INFO [wsdlgenerator:load-models] Loading models
INFO [wsdlgenerator:load-models] Generating webservices
INFO [wsdlgenerator:perform] Including /apps/visual-rules-6.4.1/server/teamserver/data/VRS_DEFAULT/build/jobs/Master Controller/workspace/IVRS_Common/vr-buildtarget/generated-resources/visual-rules
INFO
INFO --- maven-resources-plugin:2.6:resources (default-resources) # IVRS_Common ---
WARN The POM for org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.apache.maven.shared:maven-filtering:jar:1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.codehaus.plexus:plexus-interpolation:jar:1.13 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN Error injecting: org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;
maven-filtering:jar:1.1 has a dependency on plexus-container and plexus-interpolation. The missing class is in
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
<version>0.0.4</version>
</dependency>
The pom for maven-filtering seems to have the wrong relative path even though it works in windows.
<parent>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-components</artifactId>
<version>17</version>
<relativePath>../maven-shared-components/pom.xml</relativePath>
</parent>
it should be
../../maven-shared-components/17/maven-shared-components-17.pom
I've looked at some other related questions Why do I get invalid pom due to missing dependency.version although the version is managed? and The POM for <name> is invalid, transitive dependencies (if any) will not be available. I've tried running mvn install in the directory containing the maven-filtering pom and the directory of its parent but I get
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory
I tried executing mvn dependency:tree within these same two directories and I get
[ERROR] [ERROR] Invalid packaging for parent POM org.apache.maven.plugins:maven-dependency-plugin:2.8, must be "pom" but is "maven-plugin"
I went inside the pom for maven-dependency-plugin:2.8 and changed the packaging from maven-plugin to pom and I still get that error. When I make changes to the poms I use this command
mvn deploy:deploy-file -DpomFile=/export/home/user/sonatype-work/nexus/storage/repo/org/apache/maven/shared/maven-filtering/1.1/maven-filtering-1.1.pom \
-Dfile=/export/home/user/sonatype-work/nexus/storage/repo/org/apache/maven/shared/maven-filtering/1.1/maven-filtering-1.1.jar \
-DrepositoryId=repo \
-Durl=http://dendtp102d/nexus/content/repositories/repo
sometimes I just change the pom on the server without executing the deploy command and the changes are reflected when I view the repository in my browser so I'm not sure if it makes a difference.
Edit: Adding more of console output from build
INFO Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14 10:29:23-0700)
INFO Maven home: /apps/visual-rules-6.4.1/tools/apache-maven-3.2.5
INFO Java version: 1.7.0_76, vendor: Oracle Corporation
INFO Java home: /apps/jdk1.7.0_76/jre
INFO Default locale: en_US, platform encoding: UTF-8
INFO OS name: "linux", version: "2.6.32-504.el6.x86_64", arch: "amd64", family: "unix"
INFO Error stacktraces are turned on.
INFO Scanning for projects...
INFO ------------------------------------------------------------------------
INFO Reactor Build Order:
INFO
INFO Common
INFO Controller
INFO Master_Controller
INFO Controller_2
INFO
INFO ------------------------------------------------------------------------
INFO Building Common 0.0.1-SNAPSHOT
INFO ------------------------------------------------------------------------
INFO
INFO --- validation-maven-plugin:6.4.4:validate (default) # Common ---
INFO [validation:prepare] Starting validation
INFO [validation:validateModel] Validating RuleModel 'IVRS_Common'
INFO [validation:final] Validation finished
INFO
INFO --- javagenerator-maven-plugin:6.4.4:generate (default) # Common ---
INFO [vrgenerator:generate] Done
INFO
INFO --- wsgenerator-maven-plugin:6.4.4:generate (default) # Common ---
WARN The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for com.fasterxml.jackson.core:jackson-core:jar:2.2.3 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
INFO [wsdlgenerator:load-models] Loading models
INFO [wsdlgenerator:load-models] Generating webservices
INFO [wsdlgenerator:perform] Including /apps/server/teamserver/data/build/jobs/Master Controller/workspace/Common/buildtarget/generated-resources/
INFO
INFO --- maven-resources-plugin:2.6:resources (default-resources) # Common ---
WARN The POM for org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.apache.maven.shared:maven-filtering:jar:1.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN The POM for org.codehaus.plexus:plexus-interpolation:jar:1.13 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
WARN Error injecting: org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: Lorg/sonatype/plexus/build/incremental/BuildContext;
Update:
After adding the missing class to the classpath I have this error
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method "org.sonatype.plexus.build.incremental.BuildContext.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner;" the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) of the current class, org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering, and the class loader (instance of sun/misc/Launcher$AppClassLoader) for resolved class, org/sonatype/plexus/build/incremental/BuildContext, have different Class objects for the type xt.newScanner(Ljava/io/File;Z)Lorg/codehaus/plexus/util/Scanner; used in the signature
at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:221)
at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:301)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
... 14 more
I added <scope>provided</scope> to the plexus-utils dependency in both the maven-filtering pom and the plexus-container-default pom but no resolution for the error
Related
My goal is to make a Jenkins job that downloads lastest jar from Artifactory.
I'm trying to use Maven default command clean and install but job fails.
Maven should be downloading them from https://repo1.maven.org/maven2/ but Jenkins tries to download them from my local Artifactory repository http://localhost:8081/artifactory/bpidev/.
Jenkins Fail Log :
Jenkins Artifactory Plugin version: 2.7.2
Artifactory integration is enabled
[S3_CbbCustom_Deploy_UAT] $ java -classpath /jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven/boot/plexus-classworlds-2.6.0.jar -Dmaven.home=/jenkins/jenkins/tools/hudson.tasks.Maven_MavenInstallation/Maven -DbuildInfoConfig.propertiesFile=/tmp/buildInfo6009671373604071834.properties -Dm3plugin.lib=/jenkins/jenkins/cache/artifactory-plugin/2.7.2 -Dclassworlds.conf=/tmp/classworlds1010245859327507063conf -Dmaven.multiModuleProjectDirectory=/jenkins/jenkins/workspace/S3_CbbCustom_Deploy_UAT/pom.xml org.codehaus.plexus.classworlds.launcher.Launcher -f pom.xml install
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Scanning for projects...
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorderLifecycleParticipant - [buildinfo] Properties file found at '/tmp/buildInfo6009671373604071834.properties'
[main] INFO org.jfrog.build.extractor.maven.BuildInfoRecorder - Initializing Artifactory Build-Info Recording
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger -
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------< cbp.cbb:cbb-custom-3 >------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Building cbb-custom-3 [4.3.3,)
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - --------------------------------[ jar ]---------------------------------
Downloading from central: http://localhost:8081/artifactory/bpidev/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[main] WARNING org.codehaus.plexus.PlexusContainer - The POM for org.apache.maven.plugins:maven-resources-plugin:jar:2.6 is missing, no dependency information available
Downloading from artifactory-release: http://localhost:8081/artifactory/bpidev/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - BUILD FAILURE
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Total time: 0.563 s
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - Finished at: 2022-05-02T15:02:03+08:00
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------
[main] ERROR org.apache.maven.cli.MavenCli - Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Could not find artifact org.apache.maven.plugins:maven-resources-plugin:jar:2.6 in artifactory-release (http://localhost:8081/artifactory/bpidev/) -> [Help 1]
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - To see the full stack trace of the errors, re-run Maven with the -e switch.
[main] ERROR org.apache.maven.cli.MavenCli - Re-run Maven using the -X switch to enable full debug logging.
[main] ERROR org.apache.maven.cli.MavenCli -
[main] ERROR org.apache.maven.cli.MavenCli - For more information about the errors and possible solutions, please read the following articles:
[main] ERROR org.apache.maven.cli.MavenCli - [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Build step 'Invoke Artifactory Maven 3' changed build result to FAILURE
Build step 'Invoke Artifactory Maven 3' marked build as failure
Finished: FAILURE
Target jar
Jenkins configuration
pom.xml I used
Question 1. My goal is to make a Jenkins job that downloads lastest jar from Artifactory.
Am I doing it right? or is there a much simpler way?
Question 2. Why is Maven searching local Artifactory for its plugins? Where is the connnect?
Question 3. Can I make Maven to download its plugins from https://repo1.maven.org/maven2/? or should I just upload clean and install to my Artifactory repository?
It seems that your configuration for 'Resolution release repository' contains a local Artifactory repository.
Instead, you should point it to a virtual repository.
Virtual repositories will aggregate your local repository 'bpidev' and another remote repository which will point to https://repo1.maven.org/maven2/.
Maven depends on the settings.xml generated, so if it is configured to point to 'bpidev' only, he wont be able to reach the remote repository.
plugins resolution is also configured through the settings.xml as 'pluginRepository' which can also point to the same virtual repository in Artifactory which can aggregates the same remote repository so Maven will be able to download the plugins.
Referencing, https://docs.spring.io/spring-boot/docs/2.5.9/reference/html/features.html#features.logging.custom-log-configuration
It mentions to add the following system variable with the fully qualified path to the LoggingSystem you want to use, so I added the following to my application.properties file:
org.springframework.boot.logging.LoggingSystem=org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
After which I ran mvn clean install and ran my project using:
mvn -X spring-boot:run <set env vars> -f "$(pwd)"/ai-app/pom.xml
My pom has the following config:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
I even tried setting the value to none in the properties but to no avail. It was still using logback.
In the code I access the logger as follows:
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
...
...
private static final Logger LOGGER = LoggerFactory.getLogger(<class_name>.class);
Where below is a sample of the log output by the custom LOGGER
2022-04-04 18:02:04.639 INFO 58294 --- [nio-8443-exec-1] c.v.v.a.s.d.service.SomeServiceImpl : Files saved to successfully
I also tried passing in the variable via command in the two following ways:
1: -Dorg.springframework.boot.logging.LoggingSystem=org.springframework.boot.logging.log4j2.Log4J2LoggingSystem
2: spring-boot:run "-Dorg.springframework.boot.logging.LoggingSystem=org.springframework.boot.logging.log4j2.Log4J2LoggingSystem"
both of which would be included as part of the command above to run the app.
If anyone has an idea what I have to do here it would be appreciated. From the docs is says that I should be able to override the default without having to exclude the logging starter and explicitly including the log4j starter.
Thanks in advance
EDIT:
after a discussion in the comments, I followed: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#run.examples.system-properties (both adding jvmRunArgs + systemProperties in the pom as a var to the maven plugin) and got the following error when running mvn spring-boot:run:
[INFO] Attaching agents: []
[DEBUG] JVM argument(s): -Xverify:none -XX:TieredStopAtLevel=1 -Dorg.springframework.boot.logging.LoggingSystem=Log4J2LoggingSystem
[DEBUG] Classpath for forked process: /Us...
...
...
[DEBUG] Application argument(s): --safetyai.entities.libpostal.datadir=/Users/farazoman/Documents/workspace/extra/datadir/libpostal --spring.profiles.active=local
[DEBUG] Environment variable(s):
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/filter/AbstractFilter
...
...
...
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.9:run (default-cli) on project ai-app: Application finished with exit code: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.5.9:run (default-cli) on project ai-app: Application finished with exit code: 1
looks like the error is with, I may have to import log4j Core, although that doesn't look clear from the original doc :/
[DEBUG] Environment variable(s):
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/filter/AbstractFilter
I'm working on migrating a legacy application from Jboss 6 to Wildfly 18. When I try to package up my application via maven I get the error:
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
Found Banned Dependency: javax.inject:javax.inject:jar:1
Found Banned Dependency: javax.activation:activation:jar:1.1
Found Banned Dependency: stax:stax-api:jar:1.0.1
Found Banned Dependency: org.slf4j:slf4j-log4j12:jar:1.7.25
Found Banned Dependency: com.sun.mail:javax.mail:jar:1.5.6
Found Banned Dependency: com.google.inject:guice:jar:4.2.3
Use 'mvn dependency:tree' to locate the source of the banned dependencies.
[WARNING] Rule 1: org.apache.maven.plugins.enforcer.DependencyConvergence failed with message:
Failed while enforcing releasability. See above detailed error message.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.775 s
[INFO] Finished at: 2020-10-22T12:50:47-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M2:enforce (ban-bad-dependencies) on project Common: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.
Upon looking into this, my project does indeed have some dependencies on artifacts that are listed as 'Banned' by the maven-enforcer plugin in the wildfly pom. Some of the dependencies I have been able to work around, but there are others like Guice that would be very difficult to remove. I know I could override the enforcer settings in my own poms, but I don't want to do that without some idea of why they were blacklisted in the first place.
Dose anyone know where I can find documentation explaining why certain artifacts are blocked by wildfly? Has anyone tried using Guice with wildfly successfully?
Update:
the parent for my pom:
<parent>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-parent</artifactId>
<version>18.0.1.Final</version>
</parent>
I am working on resolving duplicate dependency issue. While solving I come to know that using dependency graph it will be easy. But I am not getting how to print a dependency Graph in STS4.
I have tried this command which I found in Maven Documentation
mvn dependency:tree -Dverbose -Dincludes=commons-collections
which is resulting :
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # attache-ui-web ---
[WARNING] Invalid POM for com.apple.ist.msol.attache:attache-api-entity:jar:3.0.0-SNAPSHOT, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] Invalid POM for com.apple.ist.msol.attache:attache-api-entity:jar:3.0.0-SNAPSHOT, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.972 s
[INFO] Finished at: 2019-09-17T09:30:23+05:30
[INFO] ------------------------------------------------------------------------
Can someone explain what does this result exactly mean and how to get dependency tree ?
When you open the pom.xml file in Eclipse/STS3/STS4, there is a tab to list all the dependencies as well as a tab for the dependency hierarchy. It shows you all the dependencies that you declared in your project as root nodes and their transitive dependencies as sub-nodes.
I am building a project using groovy on grails 2.3.7. Rather that using the default grails plugins I want to configure the plugins as maven dependencies.
I also want to use jetty server instead of tomcat server and mongodb instead of the regular relational databases.
After creating the project I executed 'grails create-pom' to create the pom.xml file for the project.
I have added the following changes to the pom.xml.
Removed the dependency for hibernate and added the following dependency for mongodb
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>mongodb</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
Removed the default plugin for tomcat and added the following plugin for jetty.
<dependency>
<groupId>org.grails.plugins</groupId>
<artifactId>jetty</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
<type>zip</type>
</dependency>
I have also configured the repository for grails plugins.
While executing the code I get the following error.
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.mycompany:grails-mongodb-demo:grails-app:0.1
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # line 200, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building grails-mongodb-demo 0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # grails-mongodb-demo ---
[INFO] Deleting /mnt/data/Work/Tutorials/Practice/grails/grails-mongodb-demo/target
[INFO] Deleting /mnt/data/Work/Tutorials/Practice/grails/grails-mongodb-demo/plugins (includes = [**/*], excludes = [])
[INFO]
[INFO] --- grails-maven-plugin:2.3.7:clean (default-clean) # grails-mongodb-demo ---
[WARNING] Grails Start with out fork
|Loading Grails 2.3.7
|Configuring classpath
|Running pre-compiled script
.
|Environment set to development
....................
|Application cleaned.
[INFO]
[INFO] --- grails-maven-plugin:2.3.7:validate (default-validate) # grails-mongodb-demo ---
[INFO]
[INFO] --- grails-maven-plugin:2.3.7:init (default-init) # grails-mongodb-demo ---
[INFO]
[INFO] --- grails-maven-plugin:2.3.7:config-directories (default-config-directories) # grails-mongodb-demo ---
[INFO]
[INFO] --- grails-maven-plugin:2.3.7:maven-compile (default-maven-compile) # grails-mongodb-demo ---
[WARNING] Grails Start with out fork
|Loading Grails 2.3.7
|Configuring classpath
|Running pre-compiled script
..........
|Compiling 12 source files
.Error
|
Fatal error during compilation org.apache.tools.ant.BuildException: java.lang.NoClassDefFoundError: javax/servlet/http/HttpSession (Use --stacktrace to see the full trace)
Can anyone please tell me, what plugin I am missing or is there some thing I have configured incorrectly.
Add this to you pom.xml and see if it helps:-
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>