How to add weblogic maven dependency? - maven

When I add dependency I get following error :
[ERROR] Plugin com.oracle.weblogic:weblogic-maven-plugin:10.3.6 or one of its dependencies could not be resolved: Failure to find com.oracle.weblogic:weblogic-maven-plugin:jar:10.3.6 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

I think that you have to define an extra repository in your ~/.m2/settings.xml file, or add an extra proxy repository to your artifact repository (e.g. Nexus).
It seems that getting access to that repository is somewhat involved, so I'll just point you to what would seem to be the right documentation:
https://blogs.oracle.com/WebLogicServer/entry/weblogic_server_and_the_oracle

The error implies that the plugin was not available in the plugin repository.
Please modify your pom to include the plugin as:
<build>
<plugins>
<plugin>
<groupId>com.oracle.weblogic</groupId>
<artifactId>weblogic-maven-plugin</artifactId>
<version>10.3.4</version>
<configuration>
<adminurl>t3://localhost:7001</adminurl>
<user>weblogic</user>
<password>weblogic123</password>
<upload>true</upload>
<action>deploy</action>
<remote>false</remote>
<verbose>true</verbose>
<source>${project.build.directory}/${project.build.finalName}.${project.packaging}</source>
<name>${project.build.finalName}</name>
</configuration>
</plugin>
</plugins>
</build>
Please change adminurl, user, password accordingly.

Related

maven build works on windows but fails on linux

I use the azure pipeline to build the java spring boot app using maven.
when I run the pipeline on a windows machine works fine but when I use a Linux machine gives me error.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project java-app: Compilation failure: Compilation failure:
[ERROR] Source option 5 is no longer supported. Use 6 or later.
[ERROR] Target option 1.5 is no longer supported. Use 1.6 or later.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
how can i slove this problem ?
You have different java versions on Windows, Linux. More recent versions can only downgrade up to 1.6 but not 1.5. so I assume on your Linux is a JDK 11 while on your Windows a JDK 8 or less.
However maven standard is still java 1.5, if you do not override it. Look into the other answer from #khmarbaise.
maven takes Java 1.5 default even if JAVA_HOME is set to JDK11
You have to define a more up-to-date maven-compiler-plugin like this:
<project>
[...]
<build>
[...]
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
[...]
</build>
[...]
</project>
I would suggest to use <release>8</release> depending on your used JDK..Also I would suggest to use the most recent version of Maven

Unable to deploy release package to nexus using maven release:perform

I am getting 400 errors when I try to execute maven release: perform.
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project my-project: Failed to deploy artifacts: Cou
ld not transfer artifact com.acca.project:project:pom:1.0.0-RELEASE from/to acca-nexus (https://nexus.io/repository/project/): Failed to transfer file https://nexus.io/repository/project/myproject/myproject/1.0.0-RELEASE/myproject-1.0.0-RELEASE.pom with status code 400 -> [Help 1]
Following things I have tried
1) I verified, credentials are correct
2) URL for nexus repo is correct
3) I am maintaining the proper 1.0.0-SNAPSHOT name
4) there is no package with the same version in nexus as well
5) Not a network issue as well, I can do maven deploy properly.
Release plugin -config looks like below
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<scmCommentPrefix>[maven-scm] :</scmCommentPrefix>
<goals>deploy</goals>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
I want to deploy the package when I do maven release: perform, but I am unable to debug beyond this. can someone please tell me how to debug this. Pointing out the issue will also helpful
I fixed the above issue.
The solution was in the nexus repository configuration.
I updated the configuration to "allow redeploy" and it started working.
Thank you

Failed to execute goal org.apache.maven.plugins - package does not exist

I'm trying to use mvn install, but I keep getting this error
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project example-module-core: Compilation failure: Compilation failure:
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/module/util/InitServlet.java:[10,47] package org.springframework.web.context.support does not exist
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/module/service/impl/DatabaseServiceImpl.java:[9,50] package org.springframework.transaction.annotation does not exist
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/module/service/impl/DatabaseServiceImpl.java:[22,2] cannot find symbol
[ERROR] symbol: class Transactional
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/module/service/impl/InitializerServiceImpl.java:[11,50] package org.springframework.transaction.annotation does not exist
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/module/service/impl/InitializerServiceImpl.java:[28,2] cannot find symbol
[ERROR] symbol: class Transactional
[ERROR] /C:/terasoluna-plus/example-module-core/src/main/java/com/mycompany/project/example-module-core/src/main/java/com/mycompany/project/module/util/InitServlet.java:[25,11] cannot find symbol
[ERROR] symbol: variable SpringBeanAutowiringSupport
[ERROR] location: class com.mycompany.SIAR.module.util.InitServlet
[ERROR] -> [Help 1]
In my InitServlet.java I have all the imports, and it has no errors. In the pom.xml I have all dependencies needed, but this problem always persists.
All the other solutions tell me to add the dependency and use Maven Update, but it is definitely not missing code/dependencies, because this project is being shared with 2 other users, and it works fine on the other machines. It is the exact same project.
I had this working for a few hours, after countless tries of mvn clean install, one of them got the BUILD SUCCESS and I didn't change anything, and it was working fine. But later, after changing some java files, I used mvn clean install, and got again the same error.
Any ideias of what it might be?
Thanks in advance.
I fixed it. Apparently it really needed 2 more dependencies on a pom.xml that was on another folder. I needed to add to a pom.xml that was in a core folder, these 2 dependencies.
<dependency>
<groupId>org.terasoluna.plus.framework</groupId>
<artifactId>terasoluna-plus-web-conf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
After adding it, I ran mvn clean install, and it installed successfully. Thank you anyway for all your help.
At time when it is working on other systems with exact pom , and not working on mine, I look into differences....
In my local repository - Delete the problematic dependency and run mvn clean install. Whatever dependencies are needed will be downloaded again by maven.
In my maven settings.xml - at the location ${MAVEN_HOME}/conf.What is the difference , did I over-ride any settings?
Difference in JDK version or Maven version.
I hope this helps.
you need to add maven-compiler-plugin into pom.xml. you can find the plugin code below and replace the source version by your jdk version:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source> // jdk version
<target>1.8</target> // jdk version
</configuration>
</plugin>

sonar.host.url not working with sonar-maven-plugin:2.7

After upgrading my POMs to sonar-maven-plugin:2.7 the configuration does not work any more. My configuration in settings.xml is like this:
<profile>
<id>sonar</id>
<properties>
<sonar.jdbc.url>jdbc:postgresql://my.server:5432/sonar</sonar.jdbc.url>
<sonar.jdbc.driverClassName>org.postgresql.Driver</sonar.jdbc.driverClassName>
<sonar.jdbc.username>xxxxx</sonar.jdbc.username>
<sonar.jdbc.password>yyyyy</sonar.jdbc.password>
<sonar.host.url>http://my.server</sonar.host.url>
</properties>
</profile>
The build is started with -Psonar of course. With version 2.6 everything is fine, with 2.7 I get
[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) # myproject ---
[INFO] User cache: C:\Users\me\.sonar\cache
[ERROR] SonarQube server 'http://localhost:9000' can not be reached
...
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project myproject: Fail to download libraries from server: java.net.ConnectException: Connection refused: connect -> [Help 1]
Starting the build with -X gives me the correct mojo configuration in both cases, especially the url is still correct in the log
[DEBUG] (f) sonarHostURL = http://my.server
Even deleting the mentioned caching directory does not help.
What can I do except of managing the plugin to version 2.6?
We are investigating the issue. Ticket was created: https://jira.sonarsource.com/browse/MSONAR-129
In the meantime you could either lock the SQ plugin to version 2.6 or pass all properties using command line.
Workaround: Adding -Dsonar.host.url=http://my.server:9000 to mvn command works for me
Better than disabling the plugin, you may fix the plugin version to 2.6, which works fine, taking into account sonar.host.url.
For instance, with Maven in my case:
<pluginManagement>
</plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.6</version>
<!-- sonar.host.url not working with version 2.7 -->
</plugin>
</plugins>
</pluginManagement>
I use the full qualified goal in the CI server to run the sonar goals:
mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
Since we use the templates in TeamCity this is not so much of a disaster. Still we were a bit surprised by the event.
Both
mvn -Dsonar.host.url=http://localhost:9000 org.codehaus.mojo:sonar-maven-plugin:2.6:sonar
and
mvn -Dsonar.host.url=http://localhost:9000 org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar
worked for me :
Instead of reconfiguring all jobs I disabled sonar for all jobs until this gets fixed. I added
<sonar.skip>true</sonar.skip>
to the sonar profile in settings.xml.

Sonar 4.1.1 maven plugin can't be resolved

I'm using SonarQube 4.1.1 and have the following configuration in my pom.xml file:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>4.1.1</version>
</plugin>
</plugins>
</pluginManagement>
When I try to run sonar from the command line using the maven plugin I get:
[ERROR] Plugin org.codehaus.mojo:sonar-maven-plugin:4.1.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:sonar-maven-plugin:jar:4.1.1: Failure to find org.codehaus.mojo:sonar-maven-plugin:pom:4.1.1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
Anyone know how to fix this issue? Do I need to make some configuration changes?
In fact this configuration is not needed. Have you try to run an analysis without it? You should give a try if you haven't.
But if you really need to force the version of the sonar-maven-plugin, you should set it to 2.1 on Maven 3.
See http://docs.codehaus.org/display/SONAR/Analyzing+with+Maven for more details.
Regards
Try this:
mvn clean sonar:sonar -U
The -U flag means force update of dependencies.

Resources