How to build this source code? - missing dependency - java

I need a help how to build this example:
http://blogs.oracle.com/arungupta/resource/totd154.zip
from this tutorial
http://blogs.oracle.com/arungupta/entry/totd_154_dynamic_osgi_services
I installed Netbeans 7.1. When I click Clean and Build this error occurs:
Failed to execute goal on project helloworld-cdiclient: Could not resolve dependencies for project org.samples.osgi.helloworld:helloworld-cdiclient:war:1.0-SNAPSHOT: Could not find artifact org.glassfish:osgi-cdi-api:jar:3.1-SNAPSHOT -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
After correcting the problems, you can resume the build with the command
mvn <goals> -rf :helloworld-cdiclient
I suppose that I need to add a specific glassfish repository to the maven configuration. Which repository I need?

Quoting my comments (sorry I though it will give chance to someone else to answer properly and not on the run):
To answer your question, download.java.net/maven/glassfish should help. The configuration lines are,
<repositories>
<repository>
<id>glassfish-repo</id>
<name>The Glassfish repository</name>
<url>http://download.java.net/maven/glassfish/</url>
</repository>
<!-- all the rest... -->
</repositories>
Have fun!

Related

spring project (from the spring initialzr plug in on the IDE) being Unloadable

When i create an spring project (from the spring initialzr plug in on the IDE) on netbeans 8.2 it ends up being Unloadable. How can i fix that problem?
This is the error i find:
Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.4.3/spring-boot-starter-parent-2.4.3.pom
The build could not read 1 project -> [Help 1]
The project com.nexus:RegistroEmpleados:0.0.1-SNAPSHOT (C:\Users\RobotDyn\Documents\NetBeansProjects\InitializrSpringbootProject\pom.xml) has 1 error
Non-resolvable parent POM: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.4.3 from/to central (http://repo.maven.apache.org/maven2): Failed to transfer file: http://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.4.3/spring-boot-starter-parent-2.4.3.pom. Return code is: 501 , ReasonPhrase:HTTPS Required. and 'parent.relativePath' points at no local POM # line 5, column 10 -> [Help 2]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
This is my parent code:
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.4.3
Maven dependencies are failing with a 501 error
Easiest way is to update Maven to version >= 3.2.3.
Update the Maven version repository:
Download the Apache Maven binary that includes the default https addresses (Apache Maven 3.6.3 binary). And open the Options dialog window in tools of NetBeans menu bar (Java Maven Dialog View). And select browse option in Maven Home List Box (Maven Home List Box View). After adding the Apache Maven newly downloaded version (Updated Maven Home List Box View), the project builds and runs successfully.

Which JDK version can I use to support Lombok version 1.16.16?

I have the following dependency in pom.xml
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
<version>1.16.16</version>
</dependency>
When I run mvn clean install I get the following error:
Fatal error compiling: java.lang.ExceptionInInitializerError: com.sun.tools.javac.code.TypeTags -> [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/MojoExecutionException
I found many articles which suggest that I should either upgrade the Lombok version or I should use JDK 8. I am running JDK 8 but still not able to fix this error. Can someone tell me the exact JDK version that I should use in order to get rid of this error?
Dependency will help you getting that jar. Since Lombok works while code compilation you need to install the Lombok jar
Refer to this link for installation of Lombok in your IDE
If you use Intellij, you need install plugin Lombok

Not able to deploy artifacts to Nexus repository from Jenkins

I am trying to push my artifacts to Nexus from Jenkins. I am getting the following error while I deploy to Nexus from Jenkins:
Error message in Jenkins Console Output:
15:59:06 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project sbx-java-webapp: Failed to deploy artifacts/metadata: Cannot access with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException
15:59:06 [ERROR] role: org.apache.maven.wagon.Wagon
15:59:06 [ERROR] roleHint: "http
15:59:06 [ERROR] -> [Help 1]
15:59:06 [ERROR]
15:59:06 [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
15:59:06 [ERROR] Re-run Maven using the -X switch to enable full debug logging.
15:59:06 [ERROR]
15:59:06 [ERROR] For more information about the errors and possible solutions, please read the following articles:
15:59:06 [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have tried several methods to make this work. But when I use maven deploy goal in my windows machine, it is deploying my artifacts to the same Nexus Repository without any failure. However from Jenkins, I am getting this error. In both environment the pom.xml and settings.xml that I use are same. I have tried with different maven versions as well in jenkins to solve this issue, but no help.
I have already tried mentioning wagonProvider in CLI as well as settings.xml and also I tried using extensions for wagonProviders in build and I even used extensions.xml and include this in descriptor in maven version 3.0.5 where WagonTransporterFactory is available, but none of them help me out. I also tried reinstalling and reconfiguring Jenkins, but that also doesn't help me.
If we can solve this issue, it will be great help. Thanks.
Oh....I got the issue resolved. Another example that teaches me a small error can result in bigger issue.
The issue occurred as I was passing my Nexus Repository URL as system variable in jenkins for maven deploy command as follows:
nexus_rel_repo="${NEXUS_REPO_URL}"
where NEXUS_REPO_URL was already a String Parameter that I assigned in Jenkins. And nexus_rel_repo is my system variable and you can see here that I was using double quotes when I was assigning my Nexus Repository URL which is already a String Parameter to nexus_rel_repo. The occurrence of these extra double quotes disturbed the connection.
Thanks for everyone who has looked into this issue and who has already done some research on it.

Maven, lost local dependency | Could not resolve dependencies for project

Hi guys I have a Maven project working well since 9 months.
But today I get a error in Maven build
[ERROR] Failed to execute goal on project bon: Could not resolve dependencies for project com.mydev:bon:war:1.0.20.1: Failure to find com.mydev:utils:jar:1.0.0-BUILD-SNAPSHOT in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of maven2 has elapsed or updates are forced -> [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/DependencyResolutionException
The project is a Dynamic Web Project with maven
In pom I have a dependency to local jar
<dependency>
<groupId>com.mydev</groupId>
<artifactId>utils</artifactId>
<version>1.0.0-BUILD-SNAPSHOT</version>
</dependency>
The project com.mydev.utils has installed in my PC in .m2 folder, I check the folder D:\.m2\repository\com\mydev\utils\1.0.0-BUILD-SNAPSHOT\ and everything seems in order
_rzi_0.118
_rzi_0.227
_maven.repositories
utils-1.0.0-BUILD-SNAPSHOT.jar
utils-1.0.0-BUILD-SNAPSHOT.jar.lastUpdate
utils-1.0.0-BUILD-SNAPSHOT.pom
utils-1.0.0-BUILD-SNAPSHOT.pom.lastUpdate
m2e.lastUpdate.properties
maven-metadata-local.xml
resolver-status.properties
I do not think the problem is the pom, I have not changed anything
I tried to build another project with the same unit, and get the same error.
I install software yesterday (DB2 Express-C database server), not if maven may have lost some settings for it. wheninstall the software, do not restart
Today try to generate the war, but I get the error, I reboot the PC, but I have the same error
Edit:
One more thing you do not need to do copy and paste thing , you can just easily modify your maven setting.xml for maven repo and in eclipse point it to correct file. In above scree shot user setting path should be you maven installation dir like <your dir>\apache-maven-xxx\conf\settings.xml
settings.xml
<localRepository>D:\.m2</localRepository>

Does the Spring-Flex 1.5 Sample work?

The samples and documentation in question can be found here: http://static.springsource.org/spring-flex/docs/1.5.0.M1/
The reference doc ( here ) tells us to download the sample application:
Included in the project distribution
is a collection of samples called the
Spring BlazeDS Integration Test Drive.
This samples project is set up to be
built with Maven and then imported
into Eclipse for running the
application via WTP.
The samples in question, must either be spring-flex-testdrive-spring3.zip which is linked to in the document or spring-flex-testdrive-spring3.zip based on the notion that this is release 1.5.0.M1 (docs and samples).
After I configure maven as described with the proper environment variable:
MAVEN_OPTS="-Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m"
I then execute (per instruction) the command to install: mvn clean install from the extracted samples directory (in my case C:\spring-flex-testdrive ), I receive the following error:
C:\spring-flex-testdrive>mvn clean install
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.springframework.flex.samples:spring-flex-testdrive:1.5.0.M1 (C:\spring-flex-testdrive\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Failure to find org.springframework.flex:spring-flex-parent:pom:1.5.0.M1 in http://maven.springframework.org/external was cached in the local repository, resolution will not be
reattempted until the update interval of spring-external has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM # line 5, column 10 -> [Help 2]
[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/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
C:\spring-flex-testdrive>
I have managed to get a "Spring BlazeDS" application working (with Flex), but now I'm at the point where I need to implement security, and if the samples would compile and run correctly, it'd be a huge help. I am new to Maven, but any help would be greatly appreciated!
Thanks in advance StackOverflow community!
Brian, please add the following snippet to the pom.xml in the root of the samples (from where you execute mvn clean install) and re-run Maven:
<repository>
<id>spring-milestone</id>
<name>Spring Milestone Repository</name>
<url>http://maven.springframework.org.s3.amazonaws.com/milestone</url>
</repository>
Hope that helps.
Christian
I get the same error. Spring Flex 1.5M2 will be out very soon. So maybe give it another try with that.
I would recommend that if go with Parsley for Actionscript/Flex framework. It is more mature in may ways than Spring-Actionscript. Moreover it is a required library for much of Cairngorm 3. Good luck.

Categories