NetBeans 7.2 starting the maven spring project and add sleep mode

I am trying to upgrade to maven as a build system in order to have more standard dependency management.

These are the steps that I take and the simple, (maven beginners) questions that I ask. This process is the easiest I can implement, so these problems should be very easy to reproduce.

  • Let's start with a file, a new project, Maven, a web application. In the following forms, I keep all the defaults, but for the application server field where I selected "Apache Tomcat 7.0.11.0". I notice that this wizard does not offer any Framework (Sring, Hibernate, etc.), while the standard wizard for creating projects other than maven allows you to enable the selection of frameworks.

If we look at the project now, this is what we see:

enter image description here

So the first question is: why is spring already on, even before I explicitly added it?

Let's look at the project properties:
enter image description here

Thus, no frames are selected. I want to use spring only for my dependency injection container (and at a later time I might add spring security, but that is not a priority at the moment). Do I need to add it again, because, as I said, some core modules are already included?

  1. In the project properties, under the node, I add Hibernate, and I chose the database connection. Dependencies now become the following.

enter image description here

Two of them (I highlighted them in the screenshot) are marked as “Dependency is not loaded yet. Create a project to fix errors” (you can see this message as a hint when moving the pointer to them). I built a project, but the error still remains.
On maven output, I see:

  Failed to execute goal on project CreatingMavenSpringProject: Could not resolve dependencies for project com.mycompany: CreatingMavenSpringProject: war: 1.0-SNAPSHOT: The following artifacts could not be resolved: javax.sql: jdbc-stdext: jar: 2.0, javax.transaction: jta: jar: 1.0.1B: Could not find artifact javax.sql: jdbc-stdext: jar: 2.0 in unknown-jars-temp-repo (file: C: \ Users \ agostino \ Documents \ NetBeansProjects \ CreatingMavenSpringProject / lib) - > [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.

I tried as he suggested:

  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
 n project CreatingMavenSpringProject: Could not resolve dependencies for project
  com.mycompany: CreatingMavenSpringProject: war: 1.0-SNAPSHOT: The following artifa
 cts could not be resolved: javax.sql: jdbc-stdext: jar: 2.0, javax.transaction: jta:
 jar: 1.0.1B: Failure to find javax.sql: jdbc-stdext: jar: 2.0 in file: C: \ Users \ agost
 ino \ Documents \ NetBeansProjects \ CreatingMavenSpringProject / lib was cached in the
 local repository, resolution will not be reattempted until the update interval o
 f unknown-jars-temp-repo has elapsed or updates are forced
         at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
 pendencies (LifecycleDependencyResolver.java:210)
         at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resol
 veProjectDependencies (LifecycleDependencyResolver.java:117)
         at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAr
 eResolved (MojoExecutor.java:258)
         at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor
 .java: 201)
         at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor
 .java: 153)
         at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor
 .java: 145)
         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
 ct (LifecycleModuleBuilder.java:84)
         at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
 ct (LifecycleModuleBuilder.java:59)
         at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
 ild (LifecycleStarter.java:183)
         at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (Lifecycl
 eStarter.java:161)
         at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.javahaps20)
         at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:156)
         at org.apache.maven.cli.MavenCli.execute (MavenCli.java∗37)
         at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:196)
         at org.apache.maven.cli.MavenCli.main (MavenCli.java:141)
         at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.
 java: 39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces
 sorImpl.java:25)
         at java.lang.reflect.Method.invoke (Method.java∗97)
         at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Laun
 cher.java:290)
         at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.jav
 a: 230)
         at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (La
 uncher.java:409)
         at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:
 352)
 Caused by: org.apache.maven.project.DependencyResolutionException: Could not res
 olve dependencies for project com.mycompany: CreatingMavenSpringProject: war: 1.0-S
 NAPSHOT: The following artifacts could not be resolved: javax.sql: jdbc-stdext: ja
 r: 2.0, javax.transaction: jta: jar: 1.0.1B: Failure to find javax.sql: jdbc-stdext: j
 ar: 2.0 in file: C: \ Users \ agostino \ Documents \ NetBeansProjects \ CreatingMavenSpringP
 roject / lib was cached in the local repository, resolution will not be reattempte
 d until the update interval of unknown-jars-temp-repo has elapsed or updates are
  forced
         at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (D
 efaultProjectDependenciesResolver.java:189)
         at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDe
 pendencies (LifecycleDependencyResolver.java:185)
         ... 22 more
 Caused by: org.sonatype.aether.resolution.DependencyResolutionException: The fol
 lowing artifacts could not be resolved: javax.sql: jdbc-stdext: jar: 2.0, javax.tra
 nsaction: jta: jar: 1.0.1B: Failure to find javax.sql: jdbc-stdext: jar: 2.0 in file: C
 : \ Users \ agostino \ Documents \ NetBeansProjects \ CreatingMavenSpringProject / lib was c
 ached in the local repository, resolution will not be reattempted until the upda
 te interval of unknown-jars-temp-repo has elapsed or updates are forced
         at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
 ndencies (DefaultRepositorySystem.javahaps75)
         at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve (D
 efaultProjectDependenciesResolver.java:183)
         ... 23 more
 Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: The follo
 wing artifacts could not be resolved: javax.sql: jdbc-stdext: jar: 2.0, javax.trans
 action: jta: jar: 1.0.1B: Failure to find javax.sql: jdbc-stdext: jar: 2.0 in file: C: \
 Users \ agostino \ Documents \ NetBeansProjects \ CreatingMavenSpringProject / lib was cac
 hed in the local repository, resolution will not be reattempted until the update
  interval of unknown-jars-temp-repo has elapsed or updates are forced
         at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve (Def
 aultArtifactResolver.java∗38)
         at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArti
 facts (DefaultArtifactResolver.java:216)
         at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDepe
 ndencies (DefaultRepositorySystem.javahaps58)
         ... 24 more
 Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to fi
 nd javax.sql: jdbc-stdext: jar: 2.0 in file: C: \ Users \ agostino \ Documents \ NetBeansPro
 jects \ CreatingMavenSpringProject / lib was cached in the local repository, resolut
 ion will not be reattempted until the update interval of unknown-jars-temp-repo
 has elapsed or updates are forced
         at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newExcept
 ion (DefaultUpdateCheckManager.java:230)
         at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArti
 fact (DefaultUpdateCheckManager.java:204)
         at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve (Def
 aultArtifactResolver.java:427)
         ... 26 more

And now I'm stuck on this issue, please note that this is the wrong behavior of the maven project when trying to add hibernation. How to fix it?

+4
source share
3 answers

Using Tomcat 7.0.27 I do not see the first problem (Spring dependencies), but I can duplicate the second problem (I can not load depdencies). Checking pom.xml I see that it has errors like this dependency:

 <dependency> <groupId>unknown.binary</groupId> <artifactId>derbyclient</artifactId> <version>SNAPSHOT</version> </dependency> 

and this repository:

 <repository> <id>unknown-jars-temp-repo</id> <name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name> <url>file:${project.basedir}/lib</url> </repository> 

Although the Netbeans wiki shows examples of selecting frames with Maven projects, I would recommend adding dependencies from the Add Add ... option to the Dependencies node.

Edit: Added pom.xml errors after repeating the same steps on another computer.

+3
source

You can manually modify the POM file by adding the following repository to the repository section:

 <repositories> ... <repository> <id>java.net-m2</id> <name>java.net - Maven 2</name> <url>https://repository.jboss.org/nexus/content/repositories/java.net-m2</url> </repository> </repositories> 
+3
source

You can always download dependencies manually. For example, you can download - jdbc-stdext-2.0.jar from http://download.java.net/maven/2/javax/sql/jdbc-stdext/2.0/jdbc-stdext-2.0.jar - jta-1.0. 1B.jar from http://download.java.net/maven/2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar

then put the jars in the right place in your .m2 repository. -.m2 / repository / javax / sql / jdbc-stdext / 2.0 / jdbc-stdext-2.0.jar -.m2 / repository / javax / transaction / jta / 1.0.1B / jta-1.0.1B.jar

then run maven clean and build.

-1
source

All Articles