Announcement Announcement Module
Collapse
No announcement yet.
Can't reproduce the samples Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can't reproduce the samples

    Hello everyone. I'm a new user of Spring.

    The task I've given myself is to develop my own application based on the Contacts sample in the Spring Security samples folder.

    Unfortunately, the samples provided seem to be written exclusively for the latest version of Spring (3.1.0.RC2 at the time of this writing).

    I've tried setting up Maven to get this version, but it's unable to find the files for it. All I can get is 3.1.0.M1 which is still giving me errors.

    Specifically the errors are that it can't find certain classes (such as "org.springframework.security.core.authority.Simpl eGrantedAuthority" and "org.springframework.security.acls.AclPermissionCa cheOptimizer"). liquibase is also on the fritz, giving an "invalid loc header" for some reason (ZipException).

    Is there anyone who may be able to help me out here? I've spent the last few hours trying to figure this one out and I haven't come far.

    Thanks,
    -D

  • #2
    There is a guide on how to run the sample applications using Spring Tool Suite. The guide does not use maven though, it uses gradle. Note that you do not need to install anything to use gradle.

    Originally posted by AndroidData View Post
    Unfortunately, the samples provided seem to be written exclusively for the latest version of Spring (3.1.0.RC2 at the time of this writing).
    Where did you obtain the source? The samples are released along with the rest of the code. This means that if you cloned from master, you will get the latest development snapshot. If you are using a branch or a tag, it will correspond to the latest dev instance of that branch or the tagged release.

    Originally posted by AndroidData View Post
    I've tried setting up Maven to get this version, but it's unable to find the files for it. All I can get is 3.1.0.M1 which is still giving me errors.
    What files are missing? Can you provide the pom that you are using? Did you ensure to specify the Spring Milestone maven repository?

    Originally posted by AndroidData View Post
    liquibase is also on the fritz, giving an "invalid loc header" for some reason (ZipException).
    I'm not sure I can help with that other than ensure that you are pointing to a valid maven repository and that the zip you have downloaded is valid (i.e. validate the checksum). You might try cleaning your local maven cache.

    Comment


    • #3
      Originally posted by rwinch View Post
      There is a guide on how to run the sample applications using Spring Tool Suite. The guide does not use maven though, it uses gradle. Note that you do not need to install anything to use gradle.
      I can run the samples using gradle, and I've seen the Contacts sample.

      Originally posted by rwinch View Post
      Where did you obtain the source? The samples are released along with the rest of the code. This means that if you cloned from master, you will get the latest development snapshot. If you are using a branch or a tag, it will correspond to the latest dev instance of that branch or the tagged release.
      I was reading the documentation (http://static.springsource.org/sprin...tml#get-source) and stumbled across how to get the source. I downloaded git and used it to retrieve the source, then used gradle to build it.

      Unfortunately, the source is 3.1.0.RC1 for which I can't find a Maven repository for (the milestone repository does not list the RC1 release for me).

      I've tried looking for older versions, but the given URI (https://src.springframework.org/svn/...security/tags/) does not have the 3.0.5 (AFAIK the stable) version.

      I saw the readme at https://src.springframework.org/svn/...unk/readme.txt and have been trying to get git to spit out the 3.0.5 version instead of the 3.1.0.RC1 version ever since.

      Originally posted by rwinch View Post
      What files are missing? Can you provide the pom that you are using? Did you ensure to specify the Spring Milestone maven repository?
      The Milestone repository does not contain a version "3.1.0.RC1" which I seem to need in order to use the code from the samples. I foolishly spent many hours trying to get the latest version when I should have tried to get the samples for the stable release instead.

      Originally posted by rwinch View Post
      I'm not sure I can help with that other than ensure that you are pointing to a valid maven repository and that the zip you have downloaded is valid (i.e. validate the checksum). You might try cleaning your local maven cache.
      I've ran Maven with the -U option but that hasn't helped. My current goal is to go back to the stable version (3.0.5 at the time of this writing) and figure things out from there. Hopefully I can still find the samples so I'll have a bit more to put me in the right direction.

      Thanks anyway,
      -D

      Comment


      • #4
        Your git clone contains all the previous versions (and indeed the entire project history). Use

        Code:
        git tag -l
        to list all tags, and

        Code:
        git checkout 3.0.5.RELEASE
        for example, to set the state to a particular release (or indeed any point in the history). Use

        Code:
        git checkout master
        to reset to the latest code on the master branch. While you're at it

        Code:
        git pull
        will check you have the latest changes and add them to your local copy.

        Comment


        • #5
          Aha. I was just reading up on it (was about to post my solution of "git checkout" when you replied actually).

          I've tried issuing the "git pull" command and it gave me an error: "fatal: read error: invalid argument". I don't know what that means, but I seem to have the 3.0.5.RELEASE tag instead of the HEAD tag now.

          Thanks!
          -D

          Comment


          • #6
            Originally posted by AndroidData View Post
            Unfortunately, the source is 3.1.0.RC1 for which I can't find a Maven repository for (the milestone repository does not list the RC1 release for me).
            Which resource are you unable to find in the maven repository? I am able to find quite a few of them. Can you provide your pom.xml so I can test it? Below is an example pom.xml:

            Code:
            <?xml version="1.0" encoding="UTF-8" standalone="no"?>
            <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
            	<modelVersion>4.0.0</modelVersion>
            	<groupId>test</groupId>
            	<artifactId>test</artifactId>
            	<packaging>jar</packaging>
            	<version>1.0-SNAPSHOT</version>
            	<dependencies>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-taglibs</artifactId>
            			<version>${spring.security.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-openid</artifactId>
            			<version>${spring.security.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-core</artifactId>
            			<version>${spring.security.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-web</artifactId>
            			<version>${spring.security.version}</version>
            		</dependency>
            		<dependency>
            			<groupId>org.springframework.security</groupId>
            			<artifactId>spring-security-config</artifactId>
            			<version>${spring.security.version}</version>
            		</dependency>
            
            	</dependencies>
            	<properties>
            		<spring.security.version>3.1.0.RC2</spring.security.version>
            	</properties>
            	<repositories>
            		<repository>
            			<id>org.springframework.maven.milestone</id>
            			<name>Spring Maven Milestone Repository</name>
            			<url>http://maven.springframework.org/milestone</url>
            		</repository>
            	</repositories>
            </project>
            Originally posted by AndroidData View Post
            I saw the readme at https://src.springframework.org/svn/...unk/readme.txt and have been trying to get git to spit out the 3.0.5 version instead of the 3.1.0.RC1 version ever since.
            You can perform the clone and then checkout a branch based upon the 3.0.5.RELEASE tag. For example:

            Code:
            git clone git://git.springsource.org/spring-security/spring-security.git
            git checkout -b mybranch 3.0.5.RELEASE
            I typically use m2eclipse to manage the projects prior to 3.1.x. It has been a while since I have used one of the 3.0.5.RELEASE web applications in eclipse, but I believe m2e will get you setup to run most of the applications (I don't think it will any aspects).

            HTH,

            Comment


            • #7
              Sorry didn't see it was already solved....left a tab open and forgot to submit when attempting to multi-task.

              Comment

              Working...
              X